SSH Access to Git

Committing code in Github becomes pain because of it’s asking username and password nature for each and every commit to the repository, specially when you are doing frequent commits.

Github provides a remedy to overcome it through SSH Keys. We can simply create SSH Keys and ask Github to identify our computer and don’t ask for username and password for every commit. It can be easliy done in few steps:

Step 1: Open Git Bash and execute command:

ls ~/.ssh

Step 2: Next, execute below command, and keep on pressing press Enter, it will create default public SSH key.

ssh-keygen -t rsa -C ""
For example : ssh-keygen -t rsa -C ""

Step 3: Turn on ssh-agent entering below command:

ssh-agent -s

Step 4: Add generated SSH key to the ssh-agent:

ssh-add ~/.ssh/id_rsa

Step 5: Go to directory /Users/you/.ssh and open the “” in notepad and copy the content. Now login to your Github account, click on Settings and from right panel click on SSH Keys. Now, click on Add SSH Key button and paste the “” content in it and give it any name you want.

Step 6: Testing the connection, execute below command:

ssh -T

Thats all!

Now commit the code in Github using SSH or HTTPS and I am sure Github will not ask you to enter username and password.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s