Registrations Closing Soon for DevOps Certification Training by CloudxLab | Registrations Closing in

  Enroll Now

GitHub Project - Getting Started with Git - Creating SSH keys and adding to GitHub

What are SSH keys?

SSH keys are used to identify yourself to GitHub without using username and password every time. SSH keys come in pair, a public key which is used by services like GitHub, and a private key which is stored only on our computer.

How to generate SSH keys?

Generate your ssh key pair using ssh-keygen -t rsa -b 4096 It will ask where you want to save the key. The default location is ~/.ssh/id_rsa. Press enter to continue. After this, it will ask for the passphrase. You can give an empty password by pressing enter. You will get a confirmation showing the file location.

The private key is stored in ~/.ssh/id_rsa file and public key is stored in ~/.ssh/ file. You can see the content of your public key using cat ~/.ssh/ command. Copy the output.

How to add SSH keys to your GitHub account?

Login to your GitHub account. Go to GitHub Settings by clicking on your display profile and select SSH and GPG keys from the side menu. Click on Add SSH keys button. Give any name to your key and paste the copied key.

Never share your private key. The public key can be shared anywhere.


  • The .ssh folder and key files should have correct permissions. You can check permissions using ls -la command and change them using chmod command
  • The .ssh directory permissions should be 700 (drwx------)
  • The public key (.pub file) permissions should be 644 (-rw-r--r--)
  • The private key (id_rsa) permissions should be 600 (-rw-------)
  • Generate your ssh key pair using ssh-keygen -t rsa -b 4096
  • Save the key in ~/.ssh/id_rsa file
  • Set the password or it can be left empty
  • Copy the content of ~/.ssh/ file and add it to SSH keys in GitHub account
  • Make sure you are copying only the public key stored in ~/.ssh/

No hints are availble for this assesment

Answer is not availble for this assesment

Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...