Protone Media logo

macOS authentication agent asking for a passphrase, does it forget your public/private key?

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

Thanks a lot to Jukka Suomela for sharing this solution!

Related posts

Want to stay up-to-date on Laravel news and packages?

Pascal Baljet on Twitter

Follow me on Twitter: @pascalbaljet

Pascal Baljet on Twitter

Subscribe to my YouTube channel

© 2013-2024 Protone Media B.V. Hosted with Eddy Server Management.