11

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?

bunyaCloven
  • 313
  • 1
  • 4
  • 14

4 Answers4

22

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).

Nam G VU
  • 33,193
  • 69
  • 233
  • 372
Moritur
  • 1,651
  • 1
  • 18
  • 31
8

For people who will come here in the future, my case was that pull/push working on vsc but gitkraken was giving me the message : no auth sock variable. I went into file > preferences > SSH > unmarked use local SSH agent then it automatically found my id_rsa, ida_rsa.pub (you can browse and locate them manually if needed) and now everything working fine.

OS: Arch, gitkraken version: 7.7.2

issam abbas
  • 347
  • 2
  • 9
  • Confirmed that not using "use local SSH agent" does not have the same issue as using the local agent (on Manjaro with Git Kraken 8.8.0). Small correction, it's not automatically finding your keys. id_rsa and id_rsa.pub, are the default that Git Kraken prefills in in the fields. If you have other names for your keys you'll have to select them yourself. If you only have one keypair the experience will be +- the same, f you have to deal with multiple keypairs than this solution is not ideal. – Brecht De Rooms Aug 22 '22 at 09:32
2

What helped me resolve the issue was to go to GitKraken preferences and connect both Bitbucket and Github and authorize them.

After that tick the box in "general" that says use local ssh agent. (might be

Petros Kyriakou
  • 5,214
  • 4
  • 43
  • 82
  • 1
    Thank you. This worked for me. My integration with Github was still using the Gitkraken generated SSH key. Once I reconnected the Github integration, the SSH Key field reads: Using your System SSH Local Agent. – David Nutting Oct 22 '20 at 16:24
  • I tried using the local agent but it still doesn't work for me. It was working fine for a while and then today it stopped working. I never restarted, never updated anything.. it just stopped working. But I selected local agent only then restarted GitKraken and it is now working again – Richard Apr 07 '21 at 22:12
2

If you have already set-up your local SSH agent, and your Git in terminal works, but Gitkraken does not, this might help:

First, start gitkraken from your terminal, instead of a desktop shortcut:

  • Open your favorite terminal
  • Run gitkraken
  • See if "Pull" works, or any other authenticated operation

It it works, you need to edit your Gitkraken desktop shortcut:

  • In my scenario, this is where my desktop shortcut is located, so: sudo vim /usr/share/applications/GitKraken.desktop
  • Change Exec=gitkraken %f to Exec=env SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/ssh-agent.socket" gitkraken %f
Lucas Bustamante
  • 15,821
  • 7
  • 92
  • 86
  • This worked for my situation with SSH_AUTH_SOCK changed to my specific ssh auth socket: Exec=env SSH_AUTH_SOCK=/home/username/.yubiagent/sock gitkraken %f – Evan Mar 27 '23 at 15:47
  • Interesting that Gitkraken works when starting with CLI. Now i'd need such a fix for Mac – D3strukt0r Jun 20 '23 at 15:33
  • @D3strukt0r I've asked GPT to adapt my answer to Mac, see if this works: Create an Automator app on Mac: Open Automator, select "Application", add "Run Shell Script" in "Utilities", type `open -a /Applications/GitKraken.app`, and save it. Use this to launch GitKraken. Ensure SSH Agent runs at terminal start (add `eval \`ssh-agent -s\`` & `ssh-add ~/.ssh/id_rsa` to shell profile) and your SSH key is added to GitHub. – Lucas Bustamante Jun 20 '23 at 19:46