Skip to content

Instantly share code, notes, and snippets.

@psakievich
Last active April 12, 2024 22:30
Show Gist options
  • Save psakievich/fc1bc6f90323e5720c49029c74c8a3c5 to your computer and use it in GitHub Desktop.
Save psakievich/fc1bc6f90323e5720c49029c74c8a3c5 to your computer and use it in GitHub Desktop.
The Pains of SSH Keys on a New Mac

GitHub's ssh keys are a bit of a pain on a new Mac. I've done this twice now. Making a gist so I don't forget again.

Step 1. Add GitHub as a known host

This will fail but it will add it to the ~/.ssh/known_hosts so you can see what type of key it is going to look for.

$ ssh -T git@github.com
$ cat ~/.ssh/known_hosts | grep github

Step 2. Create a new key based on the type GitHub is using

$ ssh-keygen -t ecdsa

Well on further inspection it seems like ecdsa is the common thread here and the other key types don't work.

Step 3. Manually add it to the list of keys

$ ssh-add ~/.ssh/id_ecdsa

Step 4. Try again

$ ssh -T git@github.com

Compare notes with GitHub docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment