I'm trying to connect to a remote repository under a specific IP address.
I received the private key through email and I'm on windows using Putty. The .ppk file is in Pageant.
I also created a GIT_SSH environment variable.
After these steps my personal IP was then listed in the firewall, so I guess I was able to connect.
However, when I use git bash to connect to the server, I get the message "permission denied (public key)".
The commands I used are:
$ ssh [IP]
$ ssh [username]@IP
$ ssh -T [username]@IP
Two ways to go about it
This requires setting the GIT_SSH environment variable to the full path of plink.exe (which is part of the putty suite).
Also, I would highly recommend checking if plink.exe works inside GIT Bash as follows:
Full-path-to-plink.exe -v -P port sshusername@sshserver
Another thing to check is the version of Putty suite that you are using. ( I can dig out the details later but) version 0.60 had a bug due to which processes inside cmd could not access Pageant. I believe the issue was fixed in v 0.62 but feel free to use the latest (v 0.67)
Another possibility is exporting the putty key to the OpenSSH format by using puttygen.exe and the using the exported key directly inside GIT Bash:
Conversions->Export OpenSSHand export your private key
Create the RFC 4716 version of the public key using
ssh-keygen -e -f ~/.ssh/id_dsa > ~/.ssh/id_dsa_com.pub
Convert the RFC 4716 version of the public key to the OpenSSH format:
ssh-keygen -i -f ~/.ssh/id_dsa_com.pub > ~/.ssh/id_dsa.pub
Then you can do something like this in GIT Bash to test the ssh connectivity:
GIT_SSH=ssh ssh -v sshusername@sshserver -i ~/.ssh/id_rsa