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 browse command should automatically run gh repo set-default if not yet configured #13006
Describe the feature or problem you’d like to solve
When I clone a new fork repo (git clone <fork>), and add the upstream remote locally to have both (my fork and original) repo as remotes configured (git remote add upstream <original>), and I run gh browse for the first time, it always bothers me that I have to manually copy and paste the suggested gh repo set-default command, instead of gh browse just auto-executing the command for me, so I can select the default repo and it opens fluently.
Proposed solution
When I run gh browse I would expect that it automatically asks the CLI user to select the configuration for the default remote to open.
I'm willing to submit a PR which implements this feature request.
Unfortunately, neither of these maintainers are still at GitHub so I'm not sure we'll get an answer! @mislav or @vilmibm, is there any chance you remember why you made the decision to tear out the prompting for the base repo from the rest of the command set, in favour of an error and instructive message? No worries if it doesn't come to you immediately. Hope you're doing well 👌
I didn't now about the previous issues and changes regarding this behaviour, so sorry. I'm looking forward to any further infos or developments regarding this nonetheless. 👍
No worries, neither did I to be honest. It's a great issue, it's the kind of thing that after using gh for a while you glaze over. Useful feedback.
Can I ask what your workflow is that you end up in this situation frequently? Are you doing git clone and then adding a fork remote? I ask because gh repo clone normally handles this for you.
No worries, neither did I to be honest. It's a great issue, it's the kind of thing that after using gh for a while you glaze over. Useful feedback.
Thank you!
Can I ask what your workflow is that you end up in this situation frequently? Are you doing git clone and then adding a fork remote? I ask because gh repo clone normally handles this for you.
After I created the issue, I read somewhere (I think it was in one of the issues you linked to) that the workflow automatically works when using gh repo clone. I also didn't know that command before, I might try this out if we decide that this feature would lead to too many unnecessary imports 👍
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.
EDIT: I moved the original contents of this comment to #8659, where it fits better.
Assuming @trueberryless wants to continue using his existing workflow (git clone <fork> / cd <fork> / git remote add upstream <original> / gh browse), which btw also matches what happens when doing gh repo fork, i.e. the fork is under the remote name "origin" and the original repo is under the remote name "upstream", AFAIK the only way to bypass the need to run gh repo set-default is to do what @minrk suggested in #6827:
add to ~/.gitconfig:
[remote "upstream"]
gh-resolved = base
That way, the "upstream" will always be considered the default/base repository for PRs, browsing, etc.
Beware that doing so will prevent overriding the config for specific repos via gh itself, due to #7770; however, such overrides can be added manually via git itself, e.g. git config remote.<foobar>.gh-resolved base, where <foobar> could be origin or whatever other name you'd want.
I actually mostly use gh repo clone <fork> now, and it works great for me. But I think this issue still is important for new contributors which might not know all those GitHub specific details.
Activity
williammartin commentedon Mar 26, 2026
So look, on the surface, this seems reasonable to me. I don't know why we require an extra hop. Here's my problem:
Unfortunately, neither of these maintainers are still at GitHub so I'm not sure we'll get an answer! @mislav or @vilmibm, is there any chance you remember why you made the decision to tear out the prompting for the base repo from the rest of the command set, in favour of an error and instructive message? No worries if it doesn't come to you immediately. Hope you're doing well 👌
trueberryless commentedon Mar 26, 2026
Thanks for the response!
I didn't now about the previous issues and changes regarding this behaviour, so sorry. I'm looking forward to any further infos or developments regarding this nonetheless. 👍
williammartin commentedon Mar 26, 2026
No worries, neither did I to be honest. It's a great issue, it's the kind of thing that after using
ghfor a while you glaze over. Useful feedback.Can I ask what your workflow is that you end up in this situation frequently? Are you doing
git cloneand then adding a fork remote? I ask becausegh repo clonenormally handles this for you.trueberryless commentedon Mar 27, 2026
Thank you!
Yes, I use:
git clone https://github.com/trueberryless/<fork>cd <fork>git remote add upstream https://github.com/<org>/<original>gh browsegh repo set-defaultI added this info to the issue description 🙌
After I created the issue, I read somewhere (I think it was in one of the issues you linked to) that the workflow automatically works when using
gh repo clone. I also didn't know that command before, I might try this out if we decide that this feature would lead to too many unnecessary imports 👍williammartin commentedon Mar 27, 2026
Yes, if you
gh repo clonethe fork, it will set the default to theupstreamautomatically.github-actions commentedon Mar 30, 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.
waldyrious commentedon Sep 3, 2026
Assuming @trueberryless wants to continue using his existing workflow (
git clone <fork>/cd <fork>/git remote add upstream <original>/gh browse), which btw also matches what happens when doinggh repo fork, i.e. the fork is under the remote name "origin" and the original repo is under the remote name "upstream", AFAIK the only way to bypass the need to rungh repo set-defaultis to do what @minrk suggested in #6827:That way, the "upstream" will always be considered the default/base repository for PRs, browsing, etc.
Beware that doing so will prevent overriding the config for specific repos via
ghitself, due to #7770; however, such overrides can be added manually via git itself, e.g.git config remote.<foobar>.gh-resolved base, where<foobar>could beoriginor whatever other name you'd want.trueberryless commentedon Sep 3, 2026
Thanks for the info!
I actually mostly use
gh repo clone <fork>now, and it works great for me. But I think this issue still is important for new contributors which might not know all those GitHub specific details.