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
- Ssh to your server and go to .ssh directory
Here look for the public key i.e. id_rsa.pub, if it is not there then create a new public key using
Once you execute the above command press enter, it will create a public key with name id_rsa.pub
- Now copy the content of your id_rsa.pub key of your server
- Now go to you github account and go account settings
- Click on ssh and gpg keys
- Click on new ssh key
- In title mention your name or server ip
- In key paste the content of your ssh key i.e. id_rsa.pub that you have copied
- 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.