Wednesday, 16 May 2012

Git - ssh authentication with key on windows.

Git - ssh authentication with key on windows.
As I've noticed there is a common problem setting up ssh connection with remote git repo without having to enter your password all the time. If you follow all "standard" procedures you'll be getting something like:
Access denied
fatal: The remote end hung up unexpectedly 
I don't know why this is happening, don't even want to know. So here is a quick recepie to avoid that.

1. set GIT_SSH environment variable to point to plink.exe [C:\putty\plink.exe]
2. ssh to remote host where repo is
3. cd ~
4. mkdir .ssh
5. cd .shh
6. ssh-keygen -t dsa (hit enter all the time)
7. cat id_dsa.pub >> authorized_keys
8. copy id_dsa to your windows machine (somewhere)
9. run puttygen.exe
10. press "Load" - open id_dsa file
11. press "Save private key" (save somewhere)
12. run pageant.exe
13. add key that you saved fro puttygen to pageant
14. git clone...
Should be working from now on, without need to provide password all the time.
Adapted from here

No comments:

Post a Comment