How to actually create an SSH key (on Mac)

This is a quick command-by-command reference for how to create an SSH key. It's essentially a stripped down version of this nicely-written tutorial for using SSH keys with Digital Ocean droplets. I'm assuming you're doing this on a Macbook of some sort, and that you're familiar with the basic Mac terminal commands.

Open your Mac terminal and follow these steps:

  1. cd ~
  2. ssh-keygen -t rsa
  3. Hit enter to accept the default file path.
  4. Make and remember a passphrase if you want to (you don’t have to). Hit enter.
  5. Your terminal should print out something like: “Your identification has been saved in /Users/YOURNAME/.ssh/id_rsa."
  6. Copy-paste that file path from your terminal, and use it to cd to the .ssh folder. (Omit the /id_rsa part at the end of the file path.) Your cd command should look something like: cd /Users/YOURNAME/.ssh
  7. cat
  8. Your terminal should have printed out your SSH public key, starting with “ssh-rsa” and ending with something like “yourname@Your-Macbook.local”.
  9. Copy-paste that entire thing, including the "ssh-rsa" and "yourname@Your-Macbook.local" bits at the beginning and end. This is your SSH public key. It's not a secret the way a password is, so it's ok to send around. Use it wherever you need an SSH public key that is associated with your computer.