DEV Community

techzen
techzen

Posted on • Edited on

Git Cloning with SSH

Adding SSH Keys into Github

Fedup always using HTTPS links for cloning?

Are you gettting warned by Git for going for non password based authentication?

Try SSH.

Step 1 - Generate SSH Keys

a. on Windows use (Git bash) and other machines use terminal to run following commands
$ ssh-keygen -t rsa -C ""
you may use passphrase or just enter for defaults.
the command generates 2 files HOME directory : id_rsa (private), id_rsa.pub (public)
b. Copy the entire content of id_rsa.pub into Clipboard

Step 2 - Configure Github

a. Login to Github portal. Naviagte to "Settings"
b. Under "SSH Keys", click on "New SSH Keys"
c. In the Textbox, enter the content of id_rsa.pub file and click "Add SSH Key" (Step 1.b)

Step 3 - Validate and use

a. execute following command to ensure SSH works
$ ssh -T git@github.com
Authentication success message will appear
b. grab SSH URL for cloning repository from Github
c. on local machine, run following command
$ git clone
d. you may have to give passphrase for authentication, if given
e. you can do further git operations without having to authenticate everytime

Top comments (0)