Skip to content

improve gh repo set-default to work with remote names #9149

Closed

Description

@jtnord

when using multiple repos (forks) you often need to change the default remote.

this can be accomplished with gh repo set-default [HOST/]OWNER/REPO (or via an interactive UI) however sometimes you just want to type (but type less).

I would suggest an improvement where in addition to allowing [HOST/]OWNER/REPO the command would also take a remote name from which it can (if needed) extract the needed info.

e.g.

given

❯ git remote -v
jtnord  https://github.com/jtnord/some-repo-name.git (fetch)
jtnord  https://github.com/jtnord/some-repo-name.git (push)
octocat https://github.com/octocat/some-other-repo-name.git (fetch)
octocat https://github.com/octocat/some-other-repo-name.git (push)
origin  https://github.com/myorg/some-repo-name.git (fetch)
origin  https://github.com/myorg/some-repo-name.git (push)

instead of gh repo set-default myorg/some-repo-name I should be able to use gh repo set-default origin
likewise instead of gh repo set-default octocat/some-other-repo-name I should be able to use gh repo set-default octocat

Activity

  1. added
    needs-triage
    on May 30, 2024
  2. williammartin commented on May 31, 2024

    @williammartin
    Member

    I could have sworn I'd seen this somewhere before but alas I cannot find it. I agree that this is a reasonable enhancement and something I would be happy to accept a PR for. Thanks for taking the time to write it up!

  3. added
    enhancement
    help wanted
    gh-repo
    and removed
    needs-triage
    on May 31, 2024
  4. babakks commented on Jan 14, 2026

    @babakks
    Member

    This is now added to gh, and it'll be available with the next release (i.e. v2.84.0).

  5. self-assigned this
    on Jan 14, 2026
  6. ck4865028-pixel commented on Jan 21, 2026

    @ck4865028-pixel
  7. ck4865028-pixel commented on Jan 21, 2026

    @ck4865028-pixel
  8. ck4865028-pixel commented on Jan 21, 2026

    @ck4865028-pixel
  9. ck4865028-pixel commented on Jan 21, 2026

    @ck4865028-pixel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgh-repohelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions