Skip to content

gh silently targets the upstream remote over origin. Add global default remote? #15029

Open

Agent suggestions

Public preview

Description

@ottopb

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

  1. A global config option, e.g. gh config set default_remote origin (or similar), used when a repo has no gh-resolved default.
  2. 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.
  3. Prefer origin over upstream for write commands when no default is set?

Additional context

gh version 2.102.0, macOS. Related: #14855, #13006.

Activity

  1. 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
  2. cli-triage commented on Nov 11, 2026

    @cli-triage

    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.

    Supporting reports

    Generated by issue triage.

  3. added
    core
    enhancement
    on Nov 16, 2026
  4. babakks commented on Nov 16, 2026

    @babakks
    Member

    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 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 enhancement a 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.

  5. github-actions commented on Nov 16, 2026

    @github-actions
    Contributor

    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 wanted Contributions 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.

  6. removed
    needs-triage
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions