Putty-Plink as a ssh agent for git on Windows

work git plink ssh ssh-agent putty windows

Another way to save to have an SSH agent for Windows users is to use the PuTTY tools: pageant, puttygen, putty and plink, so download the putty setup from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Make sure you install the putty tools somewhere under C:\ or anyway in some places where there are no spaces in the path

  • Convert your private key, from the OpenSSH format to PuTTY Private Key, we do this using puttygen.exe
  • Press [Win]+[R] and execute [shell:startup], then let's put a link to pageant.exe in the folder opened
  • Then open ~/.bash_profile (or your terminal emulator _profile file) and add: export GIT_SSH_COMMAND='/path/to/plink.exe -ssh -agent' so that the puttys SSH client is used by GIT in place of the OpenSSHs one
  • Then, still in the same file, let's add: /path/to/pageant.exe /path/to/.ssh/id_rsa.ppk (we can add a windows link executing at boot with this command too, anyway, it triggers for the password just once, then on other times when you've already added the key it doesn't re-trigger for the password)

I’ve got only one problem related to saving authorized_keys servers fingerprints, so we fix this by creating for just the first time a connection to the git servers host, so just open Putty, and in the windows write the servers host for the hostname and above the “Saved Sessions” label put a name for the git service, and then press the save button

Now we’re done