1

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.

2
  • What does the list of remotes look like for the working repos? Do you have the same access rights for all repos? Commented Jan 22, 2017 at 22:56
  • @HaraldNordgren Yes. The only difference is that this particular repo was ALSO connected to our university git server. But those remotes were already removed. Commented Jan 22, 2017 at 23:01

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much, I'll see what I can find out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.