Murgittroyd
Murgittroyd

Reputation: 73

Permission denied error on git push

So in trying to run

git push origin master

I got the following prompt:

The authenticity of host 'github.com (192.30.252.129)' can't be established.
RSA key fingerprint is ...
Are you sure you want to continue connecting (yes/no)?

To which I accidentally said 'no' to. Now, I get the following error message when trying to push:

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

If anyone could help me figure a way to re-prompt or do it manually, I'd appreciate it greatly!

NOTE: I'm even getting a Permission denied (publickey). error when trying the following:

ssh -vT [email protected]

Upvotes: 0

Views: 5451

Answers (1)

Anshul Goyal
Anshul Goyal

Reputation: 76837

One way would be to delete your ~/.ssh/known_hosts file. That way, ssh will ask you again to verify the authenticity of url.

However, you will be asked to also verify the authenticity of any other url that was already working.

EDIT

Run the following to clean up the entry from your known hosts entries:

ssh-keygen -R github.com

You seem to have generated the keys using sudo, so the keys are linked with root account. Further, it seems to me that you are trying to connect to github using another non root account, so the ssh keys simply don't match. I would suggest generating ssh-keys without sudo, and then adding the respective key to your github account.

Upvotes: 1

Related Questions