Fixing Git SSH After Upgrading to macOS Sierra

Yes. I’m a latecomer to the Sierra game (due mainly to an audio hardware driver I had to wait on to be upgraded to Sierra, which finally was updated but probably won’t be updated to High Sierra…), and most developers have probably already run into this problem and have dealt with it accordingly. However, I thought it might be a good idea to capture this here for posterity…

Just this morning, immediately after upgrading to macOS Sierra, I experienced a problem by which Git began incessantly asking for my passphrase. This was an unwelcome surprise to me, but thankfully there’s a reasonably simple fix, thanks to this SuperUser suggestion:

macOS keeps asking my ssh passphrase since I updated to Sierra – Super User

In the latest version of macOS (10.12.2), this is easy to fix. Just edit your ~/.ssh/config and enable the UseKeychain option:

Host *
 UseKeychain yes

There is no need to change anything else. Now everything works the way it used to work before the latest updates. You do not need to add keys to ssh-agent.

In my case, I couldn’t just edit the config file in question, because it didn’t exist. Therefore, I had to create the config file in my ~/.ssh directory with the information mentioned in the SuperUser post.

Thankfully, after creating the file, re-launching Terminal, and entering my credentials one final time, it seems to have worked and Git is happy again.