Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upgh : error adding remote: fatal: remote fork already exists. #1605
Comments
|
@bobbytreed Sorry for the nuisance! Just to double-check: if you check I'm confused why you are seeing the error because we already try to detect a fork you have push access to, and if one exists, we automatically push to it. I don't understand why gh is trying to add yet another Tip: you can set |
|
It initially pointed to an https url even though repo was cloned with ssh (another bug already created ). Problem is that it threw a credential exception with http because the org requires SAML. I updated forks to use ssh, and still get this error. |
|
@bobbytreed Thanks for looking into this! BTW you can configure GitHub CLI to default to SSH-style URLs everywhere:
|
|
How would I set DEBUG to 1? PowerShell doesn't like unnamed variables that are not preceded by $ signs |
|
Also, did change the ssh flag. Thanks. Still getting error though. gh : error adding remote: fatal: remote fork already exists.
git: exit status 128 |
|
@bobbytreed Apologies, my instructions were not meant for PowerShell. Something like this should work for PowerShell:
|
|
[git status --porcelain]
Even more worrisome that its trying to create it under that location. fork git@github.com:DCtheGeek/*********** (fetch) so why is it inventing an http hook to reach out to that is not specified in any remote? |
|
There are multiple SSH users on this machine, so I know that can cause confusion, but still I would think gh.exe would go by the remotes to check for fork locations |
|
@bobbytreed What would your preferred behavior for gh be here, ideally? When you do You can try to work around this by ensuring that the current branch is fully pushed to one of your git remotes before running gh does not yet have support for multiple logged in users #326 |
|
I understand your logic, but how am I authenticated as bobbytreed? The GITHUB_TOKEN, and GITHUB_OAUTHTOKEN, and SSH Key are all from DCtheGeek. How is it determining that I am bobbytreed? I want to know which method gh is using to determine who I am? Because in the schema I just described. It is very confusing to determine how it figures out who I am, and furthermore, gh creates a remote fork, but then somehow ignores it? gh created the remote fork pointing to https://github.com/bobbytreed. So I changed the remote and tried the command again, but it still attempted to create it under my account. Why would gh bother to create something that it would ignore? Understanding the authentication process and where the OAUTH_TOKEN, SSH key,and GITHUB_TOKEN come into play will help me make sure that I am on the right track. |
gh first reads the token from You can check your currently authenticated user with: The state of authentication right now is indeed confusing! In the upcoming release this week, verifying the status of your authentication will be easier via the dedicated |
When creating a PR using the command gh pr create --title "$($msg): Batch($i)" --body "$Body" -a $Assignee
GH complains as follows: gh : error adding remote: fatal: remote fork already exists.
. . . I know the fork already exists. I forked it (6 months ago). Is gh pr create assuming I need to delete all my forks for each pr creation? Why not just use the fork that I just pushed to?
gh version 0.11.1 (2020-07-28)
https://github.com/cli/cli/releases/tag/v0.11.1