For Mac OSX Sierra, I found that the fixes suggested in the github issue for Open Radar fixed my problem. Seems like Sierra changed the default behavior (I started having this problem after upgrading).
This one I found especially useful: https://github.com/lionheart/openradar-mirror/issues/15361#issuecomment-249059061
ssh-add -A
This resulted in my identity being added to the agent, after I ran
ssh-add -K {/path/to/key}
To summarize, in OSX.12:
ssh-add -K {/path/to/key}
ssh-add -A
should result in:
Identity added: {/path/to/file} ({/path/to/file})
EDIT:
I noticed the next time I did a full reboot (aka the agent stopped and restarted) this no longer worked. The more complete solution is what @ChrisJF mentioned above: creating a ~/.ssh/config
file. Here's the output of mine:
$ cat ~/.ssh/config
Host *
UseKeychain yes
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa
You can add as many IdentityFile
entries as you need, but this is the default setup. This is the "trending" answer on the openradar link above, ATM, as well.