Monday, December 3, 2012

Getting git 1.8.0 to work with PuTTY/plink/pageant 0.62

I am successfully running the following things together:

  • Windows 8
  • Git-1.8.0-preview20121022.exe from here
  • PuTTY, plink, and pageant, all version 0.62, from here

I'm not sure if the Startup menu exists any more in Windows 8. To make pageant.exe run at startup and load my key, I used regedit to add a registry value under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run. The value is a String, the name can be whatever, and the value should be something like:

"C:\Program Files (x86)\PuTTY\pageant.exe" "C:\your\private\key.ppk"

By default, the version of SSH that ships with msysgit does not try to access pageant. You have to configure git to use plink.exe instead. Lots of people on the internet will tell you that you must set the GIT_SSH environment variable to be the full path to plink.exe, but for some reason that wasn't working for me this time. I'm sure this is not optimal, but my solution was to move plink.exe to "C:\Program Files (x86)\Git\bin\ssh.exe", overwriting the original ssh.exe. (I saved a copy of the of the original ssh.exe just in case I need it later.)

Anyway, it works now so I can continue working on all of my favorite coding projects.

UPDATE: See my new and improved article entitled Git and PuTTY in Windows.

2 comments:

  1. The reason it doesn't work is because msysgit uses OpenSSH, which differs in agent protocol than what PuTTY uses (plink & pageant). OpenSSH won't recognize .ppk files, which is why you must choose "Conversion > OpenSSH" in pageant in order to get the same key to work with the OpenSSH protocol.

    In essence, you deleted OpenSSH and replaced it with the plink agent. Nice trick =]

    ReplyDelete
    Replies
    1. Hmm, I don't follow. I would think that the communication to the agent would be handled by the SSH executable, and that the SSH executable should be specifiable with the GIT_SSH environment variable. I don't know why it wasn't working for me when I wrote this post; it started working later when I wrote this better post:

      http://blog.davidegrayson.com/2013/04/git-and-putty-in-windows.html

      Delete