I added a ssh key to the agent by:
$ ssh-add ~/.ssh/id_rsa_mac
Identity added: /Users/alex/.ssh/id_rsa_mac (/Users/alex/.ssh/id_rsa_mac)
After a reboot the agent doesn't have this key added anymore:
$ ssh-add -l
The agent has no identities.
Why did this happen?
Best Answer
The addition of keys to the agent is transient. They last only so long as the agent is running. If you kill it or restart your computer they're lost until you re-add them again. From the
ssh-agent
man page:macOS Sierra
Starting with macOS Sierra 10.12.2, Apple has added a UseKeychain config option for SSH configs. You can activate this feature by adding
UseKeychain yes
to your~/.ssh/config
.OSX Keychain
I do not use OSX but did find this Q&A on SuperUser titled: How to use Mac OS X Keychain with SSH keys?.
So from the sound of it you could import your SSH keys into Keychain using this command:
Your keys should then persist from boot to boot.
Source: Super User - How to use Mac OS X Keychain with SSH keys?