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:
-
cd ~
-
ssh-keygen -t rsa
- Hit enter to accept the default file path.
- Make and remember a passphrase if you want to (you don’t have to). Hit enter.
- Your terminal should print out something like: “Your identification has been saved in /Users/YOURNAME/.ssh/id_rsa."
- 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
cat id_rsa.pub
- Your terminal should have printed out your SSH public key, starting with “ssh-rsa” and ending with something like “yourname@Your-Macbook.local”.
- 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.