How to configure ssh keys on github
If you use GitHub, it is always better to setup ssh key as it it will save you all the time that you will spend entering your email address and password into the console every time you push a commit could have been spent coding.
In this tutorial, we’ll take you through the steps to configure ssh key on github:
1. Check for an existing ssh key pair
If you already have an existing ssh key pair, no need to create a new one.
Create a new ssh key pair if you do not have one :
ssh-keygen
Now, view the contents of the file that was created.
cat ~/.ssh/id_rsa.pub
Copy the contents of id_rsa.pub. Now, go to your github account > Settings > SSH and GPG keys > Add SSH keys
Paste the content of id_rsa.pub you copied there.
2. Test the Authentication
ssh -T [email protected]
On successful login , you’ll see
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
Now run the following command:
git remote set-url origin [email protected]:username/your-repository.git
Edit the README.md file in your repo & the add & commit the changes:
git add -A
git commit -am "Update README.md"
git push
Now, On executing “git push” command, it should not prompt for username & password.
Leave a Reply