SSH Keys

SSH keys make our task easier if we talk about git. Commonly when we try to push our changes from our local repository to remote repository it asks for our username and password, so to overcome this scenario we can add our system’s ssh key to our Github account settings and after that when we will try to push to our remote repository it won’t ask us for our credentials like username and password.

To add ssh key to your github account follow the steps mentioned below

  1. Ssh to your server and go to .ssh directory
    cd .ssh 

    Here look for the public key i.e. id_rsa.pub, if it is not there then create a new public key using

    ssh-keygen

    Once you execute the above command press enter, it will create a public key with name id_rsa.pub

  2. Now copy the content of your id_rsa.pub key of your server
  3. Now go to you github account and go account settings
  4. Click on ssh and gpg keys
  5. Click on new ssh key
  6. In title mention your name or server ip
  7. In key paste the content of your ssh key i.e. id_rsa.pub that you have copied
  8. Click on add ssh key

Now your ssh key will be added to your Github account, now when you will push your changes to your remote repository it will not ask for credentials like username and password.
NOTE:- YOU NEED TO CLONE YOUR GITHUB REPOSITORY USING SSH URL.

Subscribe Now