Fix for SSH passphrases on MacOS Sierra
Since updating to MacOS Sierra, GitHub asks me for my SSH passphrase every single time I try to pull or push.
The benefit of SSH over HTTPS is specifically that you don’t have to enter your credentials every time. From my research, this appears to be a change to how the MacOS keychain handles things in Sierra.
Fortunately, I also stumbled onto an easy fix from Josh Buchea:
- In terminal, run
cd ~/.ssh. - Next, run
open .to open the.sshdirectory. - In the
configfile, add the snippet below. If noconfigfile exists, create one first.
Host *
UseKeychain yes
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsaThis tells MacOS to use the credentials stored in your Keychain for SSH. If your token is named something other than id_rsa (the default), naturally you’ll want to change that in the snippet above.