Saturday, July 5, 2014

Using SSH public-key authentication with GIT

If your GIT remote repository uses SSH public-key authentication, you can follow the below method to clone or do any git operation via SSH.

For example, if your repository url is this

ssh://username@subdomain.domainname.com/~/git/app.git/


Let us assume C:\Users\user\.ssh\ssh2rsa as your OpenSSH private key file. Read more about keys here

Create a file called

C:\Users\user\.ssh\config with the following content


Host subdomain.domainname.com
 IdentityFile ~/.ssh/ssh2rsa


Now open GIT Bash console and type the relevant command, Eg.,

git clone ssh://username@subdomain.domainname.com/~/git/app.git

No comments:

Post a Comment