Wednesday, 22 June 2016

Version Control - 05.GitHub_Passwordless_Push

SSH keys to push your commits without asking for password:


     While working with your repositories on GitHub you commit your changes locally. And once you feel you are good with the changes then you will push all the local commits to GitHub. But on thing which annoys you at this moment is it will ask for the password everytime. 

     So, in such cases you can use the SSH-RSA keys to push your changes with out being asked for password.

     Below is the complete process of doing that.


Step 1: Go to ".ssh" dir located in your homedir
Generate an RSA key
# ssh-keygen -t rsa
Now you will have "id_rsa.pub" file.
Copy the contents of it.
Step 2:
Login to your GitHub account
Click on your account and then Click on the Settings button in the right most corner
Select "SSH and GPG keys"
Click on "New SSH Key"
Paste the copied content of "id_rsa.pub" there.
Step 3:
Go to your repository on your host or VM
Configure your Git URL
git remote set-url origin git+ssh://<username>@github.com/<accountname>/<repo_name>.git

You are all set now. Try to push your commits to the remote repo with out giving the password.

No comments :

Post a Comment