Reputation: 53119
I have a public key file associated with my github account. On my computer, all git repositories use that file when I use git push
. One repository, however, is broken and I cannot push anything. The error I get:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Since the other repositories work, there must be some problem with using the correct RSA file. How do I set the repository to use correctly the .ssh/id_rsa.pub
when connecting to GitHub? This is my list of "remotes":
github https://github.com/USERNAME/PROJECT-NAME.git (fetch)
github https://github.com/USERNAME/PROJECT-NAME.git (push)
origin [email protected]:USERNAME/PROJECT-NAME.git (fetch)
origin [email protected]:USERNAME/PROJECT-NAME.git (push)
When pushing using origin
, I need to use the RSA file.
Upvotes: 1
Views: 367
Reputation: 1323045
Check your git config -l
and your environment variables for any clue which could explain this.
With a recent enough (GIt 2.10+), you also can set the environment variable GIT_SSH_COMMAND
to:
ssh -v
That will allow to debug any git command using ssh: you will see exactly what ssh does for that repo that is might do differently for other repos.
Upvotes: 1