New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 was marked as spam.
This comment was marked as spam.
This comment has been minimized.
This comment has been minimized.
This comment was marked as spam.
This comment was marked as spam.
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:
|
This comment was marked as spam.
This comment was marked as spam.
1 similar comment
337154 |
Is there any chance of skipping any interactive shell when you interact with another? |
Hi @mislav , I've been taking a look at this and tried to make a simple fix for the first item in your list . I used the comment below as a guide.
Regarding the second item, I saw the comment below which I believe it references it. I would like to know if a conclusion has been reached regarding this? I would be willing to have a go at this part as well (if the conclusion is to go ahead), would maybe need some pointers though.
I can also open a PR with only the first part if you prefer. |
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: