The generated key consists of a pair of files, one private and one public. It’s very important that you never share the private key, ever. While you will use the public key to authenticate with the external service.
Creating a key
To generate the key using the Terminal:
# Run the command below to generate an SSH key, then follow the prompts. # Enter file location, or press enter to use the default location. # Enter a passphrase, or press enter to for no passphrase. If you opt to use a passphrase you will need to enter it to use the key. ssh-keygen
Now that the key can be copied to the clipboard ready for use:
pbcopy < ~/.ssh/id_rsa.pub
Bonus: Add the following to your .bash_profile so you only need to type your passphrase when opening the terminal.
Removing a key
# Remove the private and public key, assuming the keys are in the default location rm ~/.ssh/id_rsa && rm ~/.ssh/id_rsa.pub