As part of a recent update to macOS Sierra (formally OSX), git users have started being annoyed by the frequent and sudden request for there ssh key password.

You can follow these steps to mimic the older functionality of macOS remembering your password between sessions and restarts.

ssh-add -K ~/.ssh/id_rsa

Note: change id_rsa to match the you want to have remembered (id_rsa is the default)

ssh-add -A

Add the following to your ~/.ssh/config file:

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

If the file does not exists, create an empty file for it.

Original Source content by: ChrisJF on

Apple purposely changed the behaviour for ssh-agent in macOS 10.12 Sierra to no longer automatically load the previous SSH keys, as noted in this OpenRadar and Twitter discussion. The solution above will mimic the old behaviour of El Capitan and remember your password.