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
bugSomething isn't workinggh-reporelating to the gh repo commandhelp wantedContributions welcomepriority-3Affects a small number of users or is largely cosmetic
was forking my friend's repository and after forking it directly with gh repo fork and cloned(using option from the same command) it.
After that I relises it have a stupid name and i tried to change with gh repo rename which it says it tried to change name with my friend's name and it's 404
gh version 2.40.0 (2023-12-07)
Steps to reproduce the behavior
gh repo fork someone's fork and clone it when asked so
I expect that this occurs because repo set-default is automated to point to upstream on clone of a fork. This probably isn't the right behaviour if so but I need to think about it.
In the meantime I'd be interested what happens if you gh repo set-default first to origin and then try the rename.
Yeh that makes sense to me. I think gh repo rename should not be trying to use the default repo but the current repo. I expect it will be low priority for us to fix. Thank you for reporting!
@max-ishere can you write a single comment providing full context into the state of the remote and locally cloned repos. I don't have the full picture in my head of the workflow you are describing. If #8440 is more appropriate then please write it there, thank you.
I did the same thing as OP, forked a project, cloned it locally like this:
gh repo fork
Forking ...
Do you want to clone the repo? Yes
(I dont remember the exact prompt)
And I expected that since i asked for a fork and it cloned it, then the default repo would be origin and not upstream.
To give a counter example, if you gh repo clone upstream, gh repo fork, do some work, gh pr create, you would expect the PR to be created against the upstream, not your fork.
Like I described in #8440 (comment), perhaps repo unarchive should be using the current repo rather than the default.
Like I described in #8440 (comment), perhaps repo unarchive should be using the current repo rather than the default.
No, the default should be whatever the prompt suggests it is going to be... This is just going to be more confusing if you have a default and then unarchive has its own default that you need to set somehow else?
Since by far the most common use case is that users are forking in order to contribute back to the upstream, we choose the upstream as the default.
This is just going to be more confusing if you have a default and then unarchive has its own default that you need to set somehow else?
I'm not suggesting there's another default that you need to set, I'm suggesting that perhaps there are some set of commands which you are more likely to want to work against the fork than the upstream and we should think about whether there's a reasonable UX for that.
Also, now that I think about it, any change here would need to be backwards compatible so more likely than not we won't be able to make a simple change.
I understand that... But also... The current behavior feels like a bug. So I'd be fine if it would be fixed rather than acknowledged as the correct behavior.
I actually didn't test what would happen if I clone the fork, I wonder if that's gonna have default repo as upstream too. Can't test for now.
I didn't see the above comment on mobile. So if you don't change the behavior at least change the prompt to clone to say what it actually does. Which is cloning upstream.
...some set of commands which you are more likely to want to work against the fork than the upstream
Exactly what I mean by multiple defaults. This reminds me of the JS string and number addition where you coerce the types implicitly and get unexpected behavior. I expected that when I do an operation it's gonna happen against the default unless I specify what repo I want.
Sorry for the magnitude of comments I literally just opened the mobile app and kinda forgot how to use GitHub and also am a little sick rn so I'm having some brain fog from that too.
bugSomething isn't workinggh-reporelating to the gh repo commandhelp wantedContributions welcomepriority-3Affects a small number of users or is largely cosmetic
Activity
littleblack111 commentedon Dec 9, 2023
EDIT:
I would expect it to rename from origin not upstream, if i change .git/config and copy origin url to upstream and it will all be fine
williammartin commentedon Dec 9, 2023
I expect that this occurs because
repo set-defaultis automated to point to upstream on clone of a fork. This probably isn't the right behaviour if so but I need to think about it.In the meantime I'd be interested what happens if you
gh repo set-defaultfirst tooriginand then try the rename.williammartin commentedon Jan 16, 2024
@littleblack111 have you had a chance to check:
Thanks.
littleblack111 commentedon Jan 16, 2024
Sorry for later reply, and yes, it works after repo set-default when forked
williammartin commentedon Jan 16, 2024
Yeh that makes sense to me. I think
gh repo renameshould not be trying to use the default repo but the current repo. I expect it will be low priority for us to fix. Thank you for reporting!max-ishere commentedon Feb 14, 2024
#8659 (comment)
I did the same thing as OP, forked a project, cloned it locally like this:
(I dont remember the exact prompt)
And I expected that since i asked for a fork and it cloned it, then the default repo would be
originand notupstream.williammartin commentedon Feb 14, 2024
To give a counter example, if you
gh repo clone upstream,gh repo fork,do some work,gh pr create, you would expect the PR to be created against theupstream, not your fork.Like I described in #8440 (comment), perhaps
repo unarchiveshould be using the current repo rather than the default.max-ishere commentedon Feb 15, 2024
Yeah of course. If I do
Then what I expect gh to do is something like this:
But when it asks this:
I assume it does:
max-ishere commentedon Feb 15, 2024
No, the default should be whatever the prompt suggests it is going to be... This is just going to be more confusing if you have a default and then unarchive has its own default that you need to set somehow else?
williammartin commentedon Feb 15, 2024
That was only the first part of what I said. It was followed by forking the upstream.
It would be quite confusing if the following commands behaved differently with regards the default:
gh repo clone forkgh repo clone upstream && cd upstream && gh repo forkgh repo fork upstream > yes clone the forkSince by far the most common use case is that users are forking in order to contribute back to the upstream, we choose the upstream as the default.
I'm not suggesting there's another default that you need to set, I'm suggesting that perhaps there are some set of commands which you are more likely to want to work against the fork than the upstream and we should think about whether there's a reasonable UX for that.
williammartin commentedon Feb 15, 2024
Also, now that I think about it, any change here would need to be backwards compatible so more likely than not we won't be able to make a simple change.
max-ishere commentedon Feb 18, 2024
I understand that... But also... The current behavior feels like a bug. So I'd be fine if it would be fixed rather than acknowledged as the correct behavior.
I actually didn't test what would happen if I clone the fork, I wonder if that's gonna have default repo as upstream too. Can't test for now.
max-ishere commentedon Feb 18, 2024
I didn't see the above comment on mobile. So if you don't change the behavior at least change the prompt to clone to say what it actually does. Which is cloning upstream.
max-ishere commentedon Feb 18, 2024
Exactly what I mean by multiple defaults. This reminds me of the JS string and number addition where you coerce the types implicitly and get unexpected behavior. I expected that when I do an operation it's gonna happen against the default unless I specify what repo I want.
max-ishere commentedon Feb 18, 2024
Regardless it should not change the default repo or if it does ask about it.
max-ishere commentedon Feb 18, 2024
All these should set default to whatever they are cloning if you fork, you already cloned upstream it was the default already.
max-ishere commentedon Feb 18, 2024
Sorry for the magnitude of comments I literally just opened the mobile app and kinda forgot how to use GitHub and also am a little sick rn so I'm having some brain fog from that too.