How to make Ubuntu remember SSH passphrase for git

You have a SSH key you are using for authentication for git and you don’t want to type your passphrase in every time you pull or push? Keep reading. I’ve been struggling for this issue for a long time and I wanted to share a quick todo for those who are about to pull their hair off, just like me.

GNOME’s keyring is actually able to keep your SSH key passphrase. However, to make git able to access this feature, you need a few additional steps. This works on Ubuntu 15.04, but, it should work for other versions, too (paths can vary on different versions tough).

First make sure you have libgnome-keyring-dev package installed:

$ sudo apt-get install libgnome-keyring-dev

Then you need to build git’s gnome keyring credential utility:

$ cd /usr/share/doc/git/contrib/credential/gnome-keyring
$ sudo make

If build is successful, than all you need to do is to tell git use gnome-keyring credential utility:

$ git config --global credential.helper /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring

That’s all, now you should be able to use your SSH key for git.