Pascal Baljet, 10 Dec 2016
Every once in a while when I try to access a git repository, I need to enter a passphrase for my public/private key. Without having modified once of the keys, somehow the macOS authentication agent seems to forget the keys.
$ git pull Enter passphrase for key '/Users/pascalbaljet/.ssh/id_rsa':
Of course you could regenerate your keys and update them across all your servers and services but that's just a lot of work and completely unnecessary. You could use
ssh-add which, according to the man page, adds private key identities to the authentication agent.
$ ssh-add ~/.ssh/id_rsa Enter passphrase for /Users/pascalbaljet/.ssh/id_rsa:
Now enter your passphrase and you're good to go!
By the way, we use GitLab for collaboration and revision control, the Community Edition of their software is free to use and is absolutely awesome!
Update 23 dec.:
It seems like Apple changed something in macOS Sierra 10.12.2 that makes you enter the passphrase after every restart, they actually added an
UseKeychain option! Open your
~/.ssh/config file and add this to it:
Host * UseKeychain yes