Gitkraken with SSH to Gitlab

Diogo Mendonça picture Diogo Mendonça · Sep 9, 2016 · Viewed 11.7k times · Source

I've been having a hard time getting the auth to work with ssh keys (don't want to be prompted for user and pass every time). Configuration options / tutorials for this issue are scarce/nonexistant.

Here is the setup:

  • I believe the repo from Gitlab was added with https, can't find a way to change this, don't know if it's important.

  • I'm running Windows 10 with git-bash and have followed the tutorial on Github to generate the keys and add them to the ssh-agent. Added the public one to my gitlab profile and can "ssh -T [email protected]" successfully.

  • Have messed around with the profile inside .gitkraken and changed the paths for the ssh keys to: "useLocalAgent": true, "privateKey": "C:\Users\mendo\.ssh\id_rsa", "publicKey": "C:\Users\mendo\.ssh\id_rsa.pub".
  • When I do a pull I'm always prompted to insert the username and pass (even though I started the ssh-agent process from the git-bash).

Don't know how I can solve this so any help you guys can provide will be much appreciated. Also, can't find a single way in app or online to remove/delete a repository from the app (I hope it's not obvious and I'm making a fool of myself).

Thanks in advance for your help!

Best, Diogo

Answer

Marcello Nicoletti picture Marcello Nicoletti · Jan 25, 2017

If the repo was cloned with HTTPS then no changes to SSH settings will work. You will first have to change the URL for your remote. Luckily you can do this inside GitKraken.

First you should navigate to your repo in GitKraken.

  1. In the left panel expand the remote group (represented by a cloud). This panel may be hidden, if so you'll need to click the right facing arrow symbol that should appear under the folder icon in the top left.

Image of panel reveal button1

  1. With the remote group expanded you should see a source called Origin. Hovering over this item reveals a vertical "...", that is the options button.

Image of "..."[2

  1. Click options and select "Edit Origin". This will open a sub-window that that will have two text boxes you can edit. The push and pull urls. switch these from https://gitlab.com/user/repo.git to [email protected]:user/repo.git

Once these steps are done then you can start changing GitKraken's ssh settings. In Windows if you aren't using Pagent (from PuTTY) then you shouldn't select "use local agent" in GitKraken. Without Pagent you can only use one key at a time and change the settings when you need to change keys.

If you wanted to use the command line to change the URL you can run the git-bash equivalent to git remote set-url [email protected]:user/repo.git from within the repo's root directory.

PS: Sorry that I can't embed images directly into my answer, not enough karma for that yet. Same for extra links.