Windows – How to set up SSH auth with Windows/git/tortoisegit/putty/Synology

gitputtysshwindows

I'm hopelessly confused. I am trying to stop tortoisegit from prompting me for a password every time I pull/push (I don't mind once for each time I log on to Windows, but thereafter I want it to be automatic).

My git server is running on my Synology NAS via the official Git Server package. I clone via ssh://user@server/foo/bar.

Here's what I have done/tried:

  • created myself a public and private key pair via Puttygen.
  • started Putty Authentication Agent (pageant) and added my private key to it.
  • created an authorized_keys file on the server at /root/.ssh/. I've tried with just the Base64-encoded portion of the public key file, and also with the ---- BEGIN SSH2 PUBLIC KEY ---- header and corresponding footer.
  • set tortoisegit up to use TortoiseGitPLink.exe as the SSH client (the default, I believe). I've also tried pageant.exe, but that results in an error: "Couldn't load this key (unable to open file)"

I am still prompted for a password, and the Putty Agent does not appear to be involved in the process in any way (no keys even after authenticating). Any advice would be much appreciated.

Best Answer

Make sure you have followed heavyd directions on the ssh keys

Windows Git AND TortoiseGit require 2 environment variables set in Windows.

GIT_SSH=C:\Program Files\TortoiseGIT\bin\TortoiseGitPlink.exe

SVN_SSH=C:\Program Files\TortoiseGIT\bin\TortoiseGitPlink.exe

(replace with your paths if different)

You also need to make sure the PLINK_PROTOCOL is not being overridden. Otherwise, PLINK_PROTOCOL=ssh

After making these changes, verify access with the following:

Open a Dos Command window issue the command plink git@your git depot server name

If a list of Git repositories is returned, you are communicating with Git.

If an error is returned, you may need to edit your .ssh/config and/or etc/hosts windows files

Related Question