You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gh silently targets the upstream remote over origin. Add global default remote? #15029
Describe the feature or problem you'd like to solve
I just forked a repo and wanted to add a few commits to my fork. I renamed original repo remote to upstream and called my fork origin.
I wanted to run gh pr create and to my surprise it tried to create a PR to the original upstream repo.
I found the gh repo set-default command, but it's only per-repo and there's no global setting that I can set.
Proposed solution
A global config option, e.g. gh config set default_remote origin (or similar), used when a repo has no gh-resolved default.
In non-interactive mode with several GitHub remotes and no default, print a warning (or error) to stderr naming the chosen repo (or fail for write commands!), as is already done for some commands.
Prefer origin over upstream for write commands when no default is set?
Additional context
gh version 2.102.0, macOS. Related: #14855, #13006.
changed the title [-]Non-interactive gh silently targets the upstream remote in forks; allow a global default remote[/-][+]gh silently targets the `upstream` remote over `origin`. Add global default remote?[/+]on Nov 11, 2026
Current release 2.103.3 does not provide a global default-remote setting. gh repo set-default origin records a choice for the current clone, but when no choice is stored and prompting is unavailable, the resolver selects the first sorted remote, with upstream ranked ahead of origin. The requested warning, failure mode, or global preference is therefore a real remaining gap. Related issues cover setting a default during clone or fork, or prompting in specific commands, rather than this non-interactive fallback.
A global remote preference was also suggested in the comments on #6827. The community found a Git configuration workaround that you could look into, although it has caveats, including problems overriding it through gh repo set-default. A persistent global preference can also become surprising if you forget you configured it, so whether that tradeoff works for you depends on your workflow.
For historical context, we previously declined to make gh silently choose origin or upstream for everyone, since neither choice suits all workflows. An explicitly configured preference is a different proposal. #12044 explored that approach, but we closed it pending further discussion rather than ruling out the idea.
That said, having a "default for the default" adds another layer to repository selection, and I’m not yet convinced the benefit would outweigh the additional complexity and potential confusion. I’ll mark this as
enhancementa request to improve CLI
and keep it open for more community feedback.
For anyone else landing here, please share your thoughts and workflows, and add a thumbs-up reaction to the issue if you’d like this capability in gh. That will help us understand the interest and the use cases it would serve.
Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the
help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.
Activity
[-]Non-interactive gh silently targets the upstream remote in forks; allow a global default remote[/-][+]gh silently targets the `upstream` remote over `origin`. Add global default remote?[/+]cli-triage commentedon Nov 11, 2026
Current release 2.103.3 does not provide a global default-remote setting.
gh repo set-default originrecords a choice for the current clone, but when no choice is stored and prompting is unavailable, the resolver selects the first sorted remote, withupstreamranked ahead oforigin. The requested warning, failure mode, or global preference is therefore a real remaining gap. Related issues cover setting a default during clone or fork, or prompting in specific commands, rather than this non-interactive fallback.Supporting reports
Duplicate analysis
Label reasoning
Investigation notes
Generated by issue triage.
babakks commentedon Nov 16, 2026
Thanks for the suggestion, @ottopb! 🙏
A global remote preference was also suggested in the comments on #6827. The community found a Git configuration workaround that you could look into, although it has caveats, including problems overriding it through
gh repo set-default. A persistent global preference can also become surprising if you forget you configured it, so whether that tradeoff works for you depends on your workflow.For historical context, we previously declined to make
ghsilently chooseoriginorupstreamfor everyone, since neither choice suits all workflows. An explicitly configured preference is a different proposal. #12044 explored that approach, but we closed it pending further discussion rather than ruling out the idea.That said, having a "default for the default" adds another layer to repository selection, and I’m not yet convinced the benefit would outweigh the additional complexity and potential confusion. I’ll mark this as enhancementa request to improve CLI
and keep it open for more community feedback.
For anyone else landing here, please share your thoughts and workflows, and add a thumbs-up reaction to the issue if you’d like this capability in
gh. That will help us understand the interest and the use cases it would serve.github-actions commentedon Nov 16, 2026
Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.