Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid SSH keys on GitKraken

Tags:

git

gitkraken

I've found GitKraken and it looks cool and I never have an issue with index.lock unlike SourceTree. The only problem is I am unable to push and pull to my server in the other room. I have configured my ssh keys and that. I can push/pull to github/bitbucket account but not next room. If ever you have encountered such problems, or if ever you have a tiny bit of idea on how I maybe able to solve my problem, please let me know. I have already made contact with the support team but response is very scarce.

like image 951
shaNnex Avatar asked Dec 14 '16 14:12

shaNnex


People also ask

Why is my SSH key not working?

Make sure the authorized_keys file and the private key itself have the correct permissions and ownership. Check that key-based authentication is allowed by the server. Make sure the private key is readable by the SSH client. If you're using PuTTY, make sure your SSH keys are properly configured for the session.

Which SSH key is git using?

Since git just uses ssh to connect, it will use whichever key ssh would use to connect to the remote host. See the ~/. ssh/config file for details; the host block uses the IdentityFile directive to specify the private key to use. The ssh_config(5) manpage contains full details.


2 Answers

It seems that on my mac if I don't run ssh-add -k ~/.ssh/id_rsa then I get errors about having a bad ssh key.

This also seems to work on Ubuntu (18.04).

like image 103
gabeio Avatar answered Oct 05 '22 23:10

gabeio


Lots of answers already, and I think most of them are very helpful. I will still add some more information here, because I don't think any answer actually solves the problem all the way.

This is what I did to solve it, from start, sitting on MacOS.

  1. Run ssh-keygen to generate keys. I did provide a passphrase.
  2. Run ssh-add -K ~/.ssh/id_rsa to save my identity inside my local ssh agent. This is important. Do note here that it's an uppercase -K, which means that I want to store my passphrase too inside the local ssh agent, this will cause it to store my passphrase in the keychain so I dont need to re-enter it all the time, very neat!
  3. Inside Gitkraken, go to "Preferences -> authentication... -> General"
  4. Check "Use local SSH agent". This will tell Gitkraken to use my agent in step 2. If you don't do this then Gitkraken will use it's own bundled ssh agent and I think this is what cause problem for most people
  5. Add your ~/.ssh/id_rsa.pub public key to your server (bitbucket.org, azure devops, github or w/e).
  6. Now when you do git fetch from terminal or do git fetch from Gitkraken, it should both work. Gitkraken will use your computers own ssh agent which we have configured to authenticate us successfully.

Hope this helps some.

Update: I also had to include ssh-add -K ~/.ssh/id_rsa inside my ~/.bash_profile to make it load automatically, otherwise you'll have to run that command on every computer restart.

like image 35
Jim Aho Avatar answered Oct 05 '22 23:10

Jim Aho