Edited at

macOS SierraでSSH鍵のパスフレーズの件

More than 1 year has passed since last update.




man ssh_config



On macOS, specifies whether the system should search for passphrases in the user's keychain when
attempting to use a particular key. When the passphrase is provided by the user, this option also speci-
fies whether the passphrase should be stored into the keychain once it has been verified to be correct.
The argument must be ``yes'' or ``no''. The default is ``no''.



Specifies whether keys should be automatically added to a running ssh-agent(1). If this option is set to ``yes'' and a key is loaded from
a file, the key and its passphrase are added to the agent with the default lifetime, as if by ssh-add(1). If this option is set to
``ask'', ssh will require confirmation using the SSH_ASKPASS program before adding a key (see ssh-add(1) for details). If this option is
set to ``confirm'', each use of the key must be confirmed, as if the -c option was specified to ssh-add(1). If this option is set to
``no'', no keys are added to the agent. The argument must be ``yes'', ``confirm'', ``ask'', or ``no''. The default is ``no''.

defaultがnoのようなので.ssh/configに以下のように追記します。(どこでもいいと思いますが、自分は Host * に追加しました)

 Host *

ServerAliveInterval 1200
ServerAliveCountMax 12
TCPKeepAlive yes
Compression yes
+ AddKeysToAgent yes
+ UseKeychain yes
GSSAPIAuthentication no
UseRoaming no