1. The first thing that we need to do is create an SSH key pair to use. Creating this key pair will allow us to add the public key to GitHub. Open a terminal and enter the following command to create the SSH keypair:
2. After entering the command, a prompt appears with a default file path confirmation. Press Enter to accept the default file path.
3. Next, a password prompt appears. Our goal is convenience, since our public key is being created exclusively for GitHub. Leave the passphrase empty and press Enter.
4. Another prompt appears, this time asking for the passphrase confirmation. Leave this prompt blank as well and press Enter.
5. After passphrase confirmation, our SSH key pair is created and saved within the default file path that we accepted in step 2 of this tutorial. We will need to copy the entire contents of our public key to add to GitHub. To display the contents of the public key, enter the following command into the terminal:
6. The output of the previous command should display the contents of the public key like in the image below.
7. Highlight and copy the entire output of the previous command. Every part must be copied for the SSH key to work when added to GitHub.
8. Now that the public SSH key has been copied to the clipboard, open a web browser and navigate to GitHub, then log in to your account.
9. Click the account icon on the navigation bar on the top-right of the page. Select ‘Settings’ from the dropdown menu that appears.
10. Select ‘SSH and ‘GPG keys’ from the selection pane on the left of the page.
11. Click the green, ‘New SSH key’ button on the top-right of the page.
12. We are taken to the ‘Add New SSH Key’ page. First, enter an identifying title for the SSH key so discerning which computer the matching private key is on is easy.
13. Finally, paste the public SSH key that was copied in step 7 of this tutorial into the ‘Key’ text field.
14. Click the green, ‘Add SSH key’ button to finish the process.
15. Success! The new public SSH key has been added to the GitHub account and can now be used to simplify and secure your work.