ssh1password

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


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


Solution

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