use ssh with keychain on macOS sierra

Since macOS sierra ssh not automaticly use the the passhrase from the keychain. You have to configure ssh to use the keychain to lookup the passhrase.

In this snippet from my ~/ssh/config I enable the keychain with UseKeychain yes. The AddKeysToAgent yes line load the key by the frist use in the ssh agent. With IdentityFile I added my two ssh keys.

Host *
  UseKeychain yes
  AddKeysToAgent yes
  IdentityFile ~/.ssh/id_rsa
  IdentityFile ~/.ssh/id_ed25519

After you configure ssh you have to save the passphrase in the keychain you can do this with the following command.

ssh-add -K
# if you have a keyfile with a not default name
ssh-add -K $keyfile

Good Night, Daniel

ssh  macOS  sierra