Gitkraken cannot use local SSH agent

bunyaCloven picture bunyaCloven · Mar 4, 2017 · Viewed 11k times · Source

I have recently changed my GitHub username and when I try to push with Authentication > Use local SSH agent selected, GitKraken push fails with following error:

Push Failed
Configured SSH key is invalid. 
Please confirm that it is properly associated with your git provider.

Unselecting the option reveals proper private/public key pair located at

~/.ssh/id_rsa
~/.ssh/id_rsa.pub

and allows the push to be done.

I can also push from inside Eclipse, and via command line without error. The URL of the repository point to my new username.

So far I have checked several things:

ssh -T github.com

gives permission denied

Fingerprint of id_rsa.pub matches to a key existing in Github account.

The following command suggests that ssh tool tries rsa private key, but is rejected:

$ ssh -vT github.com
debug1: Offering RSA public key: /home/<user>/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/<user>/.ssh/id_dsa
debug1: Trying private key: /home/<user>/.ssh/id_ecdsa
debug1: Trying private key: /home/<user>/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

What is causing ssh -vT to fail in this case, and why doesn't it prevent git push/pull but fails when GitKraken tries pushing?

Answer

Moritur picture Moritur · Jun 19, 2017

For me this was caused by an upgrade to OSX Sierra. I had to execute

ssh-add -k ~/.ssh/id_rsa

(you might have to replace that with the path of the key you are using). The command adds the ssh key to the git agent. For more information see the GitHub Help Page about adding SSH Keys. You might have to add the command to some sort of setup file which is run at boot, because it seems like the ssh agent doesn't remember the key (at least for me).