How to Add SSH Keys to Your GitHub Account

Adding SSH keys to your GitHub account is a straightforward process that involves generating a new SSH key pair and then adding the public key to your GitHub account. Here are the steps to follow:

  1. Open a terminal or command prompt on your computer.
  2. Type ssh-keygen -t ed25519 -C “[email protected]” and press Enter. This command will generate a new SSH key pair with the Ed25519 algorithm, which is the recommended algorithm by GitHub. Replace [email protected] with your email address associated with your GitHub account.
  3. You will be prompted to enter a file name to save the key. Press Enter to accept the default file name or specify a different name if you prefer.
  4. You will also be prompted to enter a passphrase. A passphrase is optional but highly recommended for added security. If you choose to use a passphrase, make sure to remember it or store it in a safe place.
  5. Once the key pair is generated, type cat ~/.ssh/id_ed25519.pub and press Enter. This command will display the public key on the terminal or command prompt.
  6. Highlight and copy the entire public key.
  7. Log in to your GitHub account and click on your profile picture in the top-right corner of the page.
  8. Select “Settings” from the drop-down menu.
  9. Click on “SSH and GPG keys” from the left-hand menu.
  10. Click on the “New SSH key” button.
  11. In the “Title” field, enter a descriptive title for the key, such as “My Personal Computer”.
  12. In the “Key” field, paste the entire public key that you copied earlier.
  13. Click on the “Add SSH key” button to save the key to your GitHub account.

That’s it! You have now added an SSH key to your GitHub account, which will allow you to authenticate securely with GitHub and access your repositories without having to enter your username and password every time.