Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitkraken hates my SSH keys, that work in SourceTree

I'm connecting to a private git repository, one which I've been using fine with SourceTree for years.

I'm trying to work with GitKraken since SourceTree is getting increasingly slow, and GitKraken tells me my key pair is "invalid" and I need to check if they are in RSA format.

The key pair was generated by Putty Gen and works fine for SourceTree and other formats. I even tried reopening them in PuttyGen and exporting in RSA format, no difference.

Any idea why? I suspect it's some kind of formatting issue, but it's hard for me to tell and GitKraken has zero documentation on this error.

Thanks in advance.

like image 813
39thstreet Avatar asked Apr 21 '17 20:04

39thstreet


People also ask

How do I use SSH key in Sourcetree?

From Sourcetree, open the PuTTY Key Generator dialog by going to Tools > Create or Import SSH Keys. Click Load, navigate to your SSH folder, and click the private key. Make sure you're looking at All files if you don't see your private key. Enter your passphrase for the SSH key and click OK.

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.

Can I use same SSH key for repositories?

When using SSH with GitHub you'll often need to add deploy keys to the repo to allow read and write access over SSH.

How does Git decide which SSH key to use?

Git does not know, or care. It just runs ssh. Specifies that ssh(1) should only use the authentication identity files configured in the ssh_config files, even if ssh-agent(1) or a PKCS11Provider offers more identities. The argument to this keyword must be “yes” or “no”.


1 Answers

I did the following steps and work well.

  1. Go to Gitkraken > File > Preferences > Authentication.
  2. Uncheck "Use local SSH agent".
  3. Click the "Generate" button next to "Generate new Private/Public key" and download those files.
  4. Into Gitkraken load both files (SSH Private Key and SSH Public Key) clicking the "Browse" button and select the gitkraken_rsa and gitkraken_rsa.pub files respectively.
  5. Next to the label gitkraken_rsa.pub click on the clipboard icon in order to copy the content of that file.
  6. Go to bitbucket.org, click into the bottom left user icon, then go to, Bitbucket settings > Security > SSH Keys and delete actually keys, after that, click on Add key button, paste the content of RSA file, add label name of that key and press Add key

And it's that, you can establish secure communication between Gitkraken and bitbubket.org.

NOTE: Looks like that key generated by gitkraken has a specific number of bits different to ssh-keygen command, so if you want to generate a key with a specific number of bits use ssh-keygen -b 4096 for 4096 bits length.

like image 74
e-israel Avatar answered Sep 18 '22 17:09

e-israel