How to set up the 1Password SSH agent for Gitkraken?

939 views Asked by At

Although Gitkraken is compatible with 1Password, this is not working out of the box even with Use local SSH agent option checked in Preferences.

https://developer.1password.com/docs/ssh/agent/compatibility/#gitkraken

configured ssh is invalid

2

There are 2 answers

0
VeeeneX On BEST ANSWER

Short answer:

Prepend the following line to desktop entry of Gitkraken and replace the USER:

Exec=env SSH_AUTH_SOCK=/home/USER/.1password/agent.sock 

To fix this (fix is required after each upgrade of Gitkraken) you edit desktop entries with correct env variable.

Make sure your entry path matches one used for your distribution in this case Ubuntu.

vim /usr/share/applications/gitkraken-url-handler.desktop

# /usr/share/applications/gitkraken-url-handler.desktop
[Desktop Entry]
Name=GitKraken
Comment=Unleash your repo
GenericName=Git Client
Exec=/usr/bin/gitkraken --uri=%U
Icon=/usr/share/pixmaps/gitkraken.png
Type=Application
NoDisplay=true
StartupNotify=true
Categories=GNOME;GTK;Development;RevisionControl;
MimeType=x-scheme-handler/gitkraken;
StartupWMClass=gitkraken

And extend the line with Exec to:

Exec=env SSH_AUTH_SOCK=/home/USER/.1password/agent.sock /usr/bin/gitkraken --uri=%U

You should also do the same for this entry as well:

#/usr/share/applications/gitkraken.desktop
[Desktop Entry]
Name=GitKraken
Comment=Unleash your repo
GenericName=Git Client
Exec=/usr/share/gitkraken/gitkraken %U
Icon=/usr/share/pixmaps/gitkraken.png
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Development;RevisionControl;
MimeType=text/plain;
StartupWMClass=gitkraken

Modified line:

Exec=env SSH_AUTH_SOCK=/home/USER/.1password/agent.sock /usr/share/gitkraken/gitkraken %U

Make sure to replace USER with actual USER wise step would be to have those in your home directory as desktop entries.

0
Mike Valstar On

if you're using KDE Plasma, you can add a file to your ~/.config/plasma-workspace/env/ folder (I called mine sshsock.sh) with the following:

export SSH_AUTH_SOCK=$HOME/.1password/agent.sock

after a restart that variable will be available to gitkraken and it should work.

if you're not using kde, you may be able to get a similar result by adding the above to your ~/.xsession or ~/.profile