Using SourceTree’s Pageant with git in Powershell

I’m trying to use these tools in conjunction:

  • Powershell 5 on Windows 10
  • Git version 2.13.0.windows.1
  • Keepass 2.35 with the KeeAgent plugin to fire up Pageant
  • Putty 0.69
  • I also have SourceTree version 2.1.2.4 installed

I’ve generated a public/private key pair, loaded the public key in GitLab, GitHub, Bitbucket, and other places. I’ve loaded the private key in Pageant via KeeAgent successfully and I can see the fingerprint is correct.

Now, if I try to do git pull from Powershell I get this:

However, if I place id_rsa (an OpenSssh file generated with Putty) in my user’s .ssh folder then git pull works, but it will ask for the passphrase *every time*.

Now if I use SourceTree I can pull changes just fine! So what was the problem?

Apparently, this solution by user @CTS_AE works just fine: you have to add a System Environment Variable called “GIT_SSH” that points to “plink.exe”. For me:

GIT_SSH System Variable

Restart your Powershell session and voila: pulling in changes from the command line works again!


Footnote: If you get stuck at “Store key in cache? (y/n)” with no input from the keyboard being registered then this solution by @cambunctious might work. Just open Putty, try to SSH into bitbucket.org, and use the GUI to add the fingerprint. Silly, stupid, but it works.