skip to content

Adding A Private Ssh Key To Your Mac Keychain

Keychain Unlocked

I took the habit of having different SSH keys for different purposes:

  • connecting to servers at work
  • connecting to my home machine
  • connecting to GitHub
  • connecting to BitBucket

If you’re working from a Mac, you definitely want to add the private parts of those SSH keys to the system keychain.

That’s in fact quite simple. All you have to do is to launch the following command from your terminal:

$ /usr/bin/ssh-add -K ~.ssh/id_rsa.github.com

Note that I’m using /usr/bin/ssh-add and not just ssh-add. This is because you need to use stock Mac’s ssh-add, not the one provided by MacPorts or Homebrew (in case you upgraded OpenSSH on your mac).

Hope that helps!