How to create an RSA key on Linux and add it to your GitHub account

Here are the steps to generate and add an Ed25519 key pair on Linux and add it to your GitHub account:

  1. Open your terminal on Linux.
  2. Type the following command to generate a new Ed25519 key:
  3. ssh-keygen -t ed25519 -C "your_email@example.com"
  4. This will create a new SSH key pair with the Ed25519 algorithm. You can replace the email address with your own email.
  5. You will be prompted to enter a file path and name to save the key pair. You can leave it blank to save it in the default directory (~/.ssh).
  6. You will be prompted to enter a passphrase. It is recommended to use a strong passphrase to protect your key.
  7. Once the key pair is generated, use the following command to add the SSH key to your SSH agent:
  8. eval "$(ssh-agent -s)"
  9. ssh-add ~/.ssh/id_ed25519
  10. To add the SSH key to your GitHub account, log in to your GitHub account and go to your account settings.
  11. Click on "SSH and GPG keys" and then click on "New SSH key".
  12. In the "Title" field, enter a descriptive name for the key.
  13. In the "Key" field, copy the contents of the public key file that was generated earlier. You can do this by opening the file with a text editor and copying the entire contents. The file will be named id_ed25519.pub and located in the .ssh directory in your home folder.
  14. Click on "Add SSH key" to add the key to your GitHub account.
  15. To verify that the key has been added successfully, use the following command in your terminal:
  16. ssh -T git@github.com
  17. You should see a message that says "Hi username! You've successfully authenticated, but GitHub does not provide shell access." 

Comments