49

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.

Metafaniel
  • 29,318
  • 8
  • 40
  • 67
shaNnex
  • 1,043
  • 2
  • 19
  • 34

16 Answers16

54

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

bixiou
  • 124
  • 2
  • 10
gabeio
  • 1,282
  • 1
  • 23
  • 37
27

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.

Jim Aho
  • 9,932
  • 15
  • 56
  • 87
14

On macOS I had a Private/Public key pair and GitKraken was sucessfully using it to push to a bitbucket repository. Public key file ~/.ssh/id_rsa.pub format is similar to Josh Patterson answer:

ssh-rsa AAAAB3NzaC1yc2...8swZ0Ew==

I created a second bitbucket repo. At some point gitKraken could no longer push to the first repo. I could still git push to first repo from terminal command line, manually entering passphrase.

GitKraken said "Configured SSH key is in an invalid format. Please ensure that your key is valid and is an RSA-type key."

Similar to Coming Sun's answer I went to GitKraken Preferences/Authentication/General. Unlike Coming Sun's answer I already had a Private/Public key and didn't want to generate a new pair. Instead I selected "Use local SSH agent". This fixed GitKraken for me.

beepscore
  • 648
  • 6
  • 8
  • 5
    The "Use local SSH agent" authentication setting worked for me, thanks. – Matt Stone Jan 22 '19 at 23:21
  • It works for me only if I call ssh-add in terminal after system reboot. – dmitry1100 Mar 01 '19 at 09:54
  • 1
    Your answer worked for me except I *already* had "Use local SSH agent" selected. I unticked it and it automatically selected the SSH keys I already had and it now works fine. Go figure :) – Bruno Finger Mar 01 '19 at 10:51
  • I guess Gitkraken is more picky than your local ssh agent. In other words - your keys are indeed correct, but only your local ssh agent can handle the format your keys are in. – Jim Aho Jun 13 '19 at 08:43
11
  1. GitKraken -> Preferences -> Authentication -> Generate new Private/Public key;
  2. add the New Public key to your git server.
Corning Sun
  • 127
  • 1
  • 3
  • 1
    Having same problem. Trying to use existing public/private key pair files, and it just says they're an invalid format. – Triynko Oct 12 '19 at 03:17
4

I got mine working by using a combination of gabeios answer and also turning the option 'use local ssh agent' on and off (gitkraken preferences > authentication > 'use local ssh agent').

I turned it off and tried gabeios answer and it didn't work but then turned it on and tried again with gabeios answer. Some combination of the two worked with me for some reason. I'm on mac. Hope it helps.

Toms Code
  • 1,439
  • 3
  • 15
  • 34
  • 1
    Additionally to this, I also had to click the `Generate` green button in _GitKraken > Preferences > Authentication > General_ to _create new keys and configure GitKraken to use them_. That way, it finally worked. – Metafaniel Jun 17 '20 at 22:01
3

So in case this helps someone else (or me once I've forgotten), it appears that GIT Kraken is very picky about its public key format, and does NOT support what I think of the standard format. I usually see keys that look like:

---- BEGIN SSH2 PUBLIC KEY ----
Comment: "rsa-key-20181204"
AAAAB3NzaC1yc2EAAAABJQAAAQEA5kpsxjtSZ4kMyKIBy0ASQShN/BSAEa7d4lrL
...
hA2TX0L2fLKDkpzCngkDgGbLDxj5dXTN4gpnZdr7lzMciFQu0uhfTLmeYgi1nFOi
KfJ+cQWg3uOHQ0zd8/2GyvfARWy3nZDFoLSQTrbErkX8swZ0Ew==
---- END SSH2 PUBLIC KEY ----

Git Kraken seems to insist on this format:

ssh-rsa AAAAB3NzaC1yc2...8swZ0Ew==

You can see this is the "same" key but it needs to be in the simpler format for Git Kraken to be happy with it.

Thanks, Josh

2

Preferences... > Authentication

I just had to switch to

[ ] Use local SSH agent

Instead of using the path to my local ssh

Baldráni
  • 5,332
  • 7
  • 51
  • 79
2

Since the previous answers didn't work for me, here's another quick and easy tip that might work:

  1. Go to preferences/integration/github.
  2. You'll find an ssh key like "Gitkraken Ubuntu"
  3. It'll say something like "unpublished" -> Click "add to GitHub"

Voilá! You've been authorized

gitkraken github integration screenshot

s-gbz
  • 402
  • 8
  • 11
1

gabeio's answer works. To avoid calling ssh-add -K ~/.ssh/id_rsa in the terminal every single time, it can be add to the profile file.

You can put it to ~/.bash_profile:

put ssh-add -K ~/.ssh/id_rsa inside your~/.bash_profile

But it requires to open the terminal to execute this line.

In my case, I added it to /etc/profile. Add the line, ssh-add -K ~/.ssh/id_rsa at the bottom of /etc/profile. Here are the instructions in the terminal:

  • Change permission of the file, $sudo chmod 644 /etc/profile
  • Edit the file, $sudo nano /etc/profile
  • Add this line at the bottom of the file, ssh-add -K ~/.ssh/id_rsa.
  • Close and save the file
  • Reboot.

It works for me without opening the terminal every time. Hope it can help.

1

If you are trying to access a repository in Github but it doesn't work.

This worked for me:

First, watch if you have "write access" in your Repository

(Setting -> Manage Access)

If the error persists:

  1. Disconnect Github account in Gitkraken

    (File-> Preferences -> Authentication -> Github -> Disconnect)

  2. Revoque Access to Gitkraken in Github

    (Settings-> Applications -> Authorized Oauth Apps -> Gitkraken -> Revoke)

  3. Connect again Gitkraken to Github

    (make sure that you give permission to all your repositories)

I hope this will be helpful to you :)

Shoniisra
  • 621
  • 7
  • 6
1

I have lots of keys for multiple projects and identities already managed perfectly well in ~/.ssh/config and/or ~/.gitconfig with no desire to track/reference them in yet another place!

So far most of the working answers require having my keys and definitions in ~/.ssh/config and then also adding a reference/call to ssh-add -K ~/.ssh/... in ~/.bash_profile and/or ~/.profile neither of which is ideal.

I was about to create a function to drop in ~/.bash_profile and/or ~/.profile to iterate through all the keys and subfolders in ~/.ssh/*/... so at least I don't need to remember to add new keys there.

Then I found this beautiful approach here where all I need to do is add an additional AddKeysToAgent yes instruction in ~/.ssh/config for any credentials I want to have automatically added to ssh-agent:

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/[your-secure-ssh-key-name]

NOTE: this will still require that you run ssh-add -K ~/.ssh/[your-secure-ssh-key-name] at least once to store the password in your keychain. Otherwise, you can omit UseKeychain yes and you will be prompted for your password when the keys are used.

This will persist across reboots and just "magically work" for CLI as well as apps like GitKraken.

The UseKeychain yes instruction can also be omitted when the key does not have a password, and you do NOT need to apply this instruction to all hosts. Here is an example of a specific host with a subdomain wildcard to capture multiple projects hosted by the same provider:

Host project1.myrepo.com
 User git
 PreferredAuthentications publickey
 IdentityFile ~/.ssh/myrepo.com/project1
 AddKeysToAgent yes
 UseKeychain no

Host *.myrepo.com
 User git
 PreferredAuthentications publickey
 IdentityFile ~/.ssh/myrepo.com/[your-secure-ssh-key-name]
 AddKeysToAgent yes
 UseKeychain yes

Host git-codecommit.*.amazonaws.com
 User ABC1234DEFGHI1234
 IdentityFile ~/.ssh/[your-secure-ssh-key-name]
 AddKeysToAgent yes

Host *
  AddKeysToAgent no
  UseKeychain no
  IdentityFile ~/.ssh/id_rsa
theVinchi
  • 1,185
  • 7
  • 8
0

Make sure your remote is set correctly. Gitkraken will allow you to clone by pasting in the "git clone" command but it will erroneously set that as the origin

0

After trying all the answers, even one from myself that didn't work later when I had the problem yet again, I noticed the problem is not related to SSH keys but to a given option in GitKraken UI (latest version to time of writing: 7.3.2)

Even having added the SSH Keys successfully, attempting to clone using the following option: File > Clone Repo > Clone with URL (using SSH or HTTPS) will result in this error:

Clone Failed
C:\path-to-folder Conf‌igured SSH key is invalid. Please conf‌irm that it is properly associated with your Git provider.

However... it works with the following option: File > Clone Repo > Bitbucket.org > Repository to Clone (select one of the repositories in the account).

Successfully cloned repo 'my_repo'

Shouldn't Clone with URL option had to work anyway?

Oh well...

Metafaniel
  • 29,318
  • 8
  • 40
  • 67
  • I came back to check my own answer yet again. I can't upvote myself haha. I guess the _Clone with URL_ option is counter intuitive or it should do the same as the other one... – Metafaniel Oct 03 '20 at 20:55
0

This applies to Windows users. My config is Win 10, with GitKraken v8.2. It may work on other configs, however ymmv.

  1. Install Putty and Pageant, if you have not already installed them. Can be found here: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
  2. Launch Pageant by going to the install folder, and double clicking on it. Alternatively, open up a command prompt and type "Pageant"
  3. In the system tray, find the Pageant icon, right click on it, and click "Add Key". Point it to the PPK file that you have.
  4. In GitKraken, go to Preferences -> SSH and select "Use local SSH Agent". It will now use Pageant

You should now be able to clone/push/pull to remote servers using SSH. For self-hosted git servers, make sure to use the correct url, in the format ssh://{user}@{host}/{repo}, where "repo" is the full path on the host machine

lsu_guy
  • 1,525
  • 15
  • 12
0

I tried using the way integrated into GitKragen but it kept giving me trouble, so I tried creating the keys on my own as in the GitHub documentation.

  1. Generating a new SSH key

First we need to have the keys:

ssh-keygen -t ed25519-sk -C "your_email@example.com"

I did not add them to the ssh-agent, instead I selected the files directly on GitKraken

enter image description here

  1. Add the new SSH key to your GitHub account

  2. Finally, test you connection.

Echo9k
  • 554
  • 6
  • 9
0

Hint: in my case had to double check the agent was refering to the proper file names.

Since kraken generates its own files under the name 'kraken-rsa' then the ssh agent will fail locate the files because its looking for ssh-rsa files.

So double check the kraken-rsa file names.

petras J
  • 2,538
  • 3
  • 16
  • 23