Git push keep getting permission denied after mac

2019-03-17 05:38发布

问题:

Wondering if anyone experiencing the same issue with OSX 10.9.2 Update. After installing that update, I couldn't do git push anymore, keep getting permission denied(public key).

Have tried to generate a new ssh pair, and reenter the new key to server, but still no luck.

Also tried to do it on another git hosting after inserting a new key, still doesnt work. So I guess its not a server problem, but a OSX 10.9.2 issue.

Any suggestion would be appreciated.

Thanks!

回答1:

I ran into the same problem with the Mavericks 10.9.2 update. Anything using your ssh public key (ssh, git, svn, etc) will have a problem. It seems that the ssh agent somehow forgot about your key.

Running ssh-add from the terminal fixed it for me. From these sources:

https://help.github.com/articles/error-agent-admitted-failure-to-sign
http://www.cyberciti.biz/faq/unix-appleosx-linux-bsd-agent-admitted-failuretosignusingkey/

Cheers



回答2:

Add your ssh keys to your Keychain by running ssh-add -K ~/.ssh/<keyfile>.

You can use * as key file to add all keys. This will ask for a passphrase for files which are not private keys. Just press enter for those files.

This adds keychain entries even for non-encrypted keys, i.e. keys that don't require a passphrase. After that it is not required to add the keys to the ssh-agent. So you can remove all keys from the agent by running ssh-add -D and public key authentication still works.