Repo fork ignores the --remote
flag when specifying a repository via argument
#2722
Comments
Thanks for reporting! Try this workaround:
Explanation: most gh commands do operations on the current repository and, alternatively, they take the repository via argument or flag. You've passed a repository argument by doing I think the "fix" here would be to have |
How does |
I want to both specify the remote to fork, and also have it add a new fork remote. I'm happy to script around gh, but as it doesn't return the URL of the fork I don't think I can. |
No. For each local repo that has multiple GitHub remotes, gh tries to resolve the "base" remote by:
Sorry, specifying the remote to fork isn't available right now. Could you describe your use-case with several remotes? In the meantime, you could use the
|
Current remotes:
Desired Remotes:
I want to be able to fork repos and then clean them, so they don't have duplicate branches, this requires pushing the head ref of the "up" remote to its "fork" remote. Current alias: https://github.com/gibfahn/dot/blob/7f16e16f1d34046e80f48fb3ce86415ddc1779c3/dotfiles/.config/git/config#L7 , it uses |
@gibfahn Thanks for describing your use case! We need to ponder about this. Right now we don't have good support for mixed GHE + GitHub.com remotes. It looks like you would need a way to select a remote to fork and also to choose how the new remote for the fork should be named. E.g.
We need to discuss with the team whether this is something that we would want to enable. |
--remote
flag when specifying a repository via argument
This comment has been minimized.
This comment has been minimized.
This comment was marked as spam.
This comment was marked as spam.
This comment has been minimized.
This comment has been minimized.
This fixes cli#2722, in which a Git remote is never added if repo fork was given an argument. By default, the remote is only added when no argument is given. Here, we check if the argument is one of the existing remotes, and consider that the remote should be added. THIS IS BRITTLE AND A HACK AND SHOULD NOT BE USED.
No, but I can see how this is confusing. Thanks for linking that. The This thread describes a bug and a feature, none of which were yet addressed:
|
Describe the bug
When I try to fork a repo and add a new remote, it doesn't add a new remote to my current repository.
gh version 1.4.0 (2020-12-17)
Expected vs actual behavior
I expect to see a fork remote added to my repository, but nothing is added.
Logs
The text was updated successfully, but these errors were encountered: