Skip to content
TrySitePrice

How to fix: MacOS keep asking passphrase for ssh key after upgrade or reboots

Best/Tutorial

If your MacOS keeps asking for the passphrase for your ssh key after an upgrade or a reboot, there are a few possible solutions:

  1. Use ssh-add to add the key to the ssh-agent:
eval "$(ssh-agent -s)"
ssh-add -K ~/.ssh/id_rsa

The -K option stores the passphrase in the Keychain, so you won't be prompted for it again.

  1. Check if the ssh-agent is running:
ps -e | grep ssh-agent

If the ssh-agent is not running, start it by running the following command:

eval "$(ssh-agent -s)"

  1. Verify that your ssh key is listed in the ssh-agent:
ssh-add -l

If your ssh key is not listed, add it by running the following command:

ssh-add ~/.ssh/id_rsa

  1. Check the permissions on your ssh key:
ls -l ~/.ssh/id_rsa

The permissions on your ssh key should be set to 0600. If the permissions are incorrect, set them with the following command:

chmod 0600 ~/.ssh/id_rsa

Try these solutions one by one, and the issue should be resolved. If not, please provide more information about your setup and any error messages you may be encountering.