Git + SSH + PuTTY/Pageant headaches

Here’s a bug I’ve struggled with for a while now but finally found a workaround. I have Git repos spread across GitHub, BitBucket, VSTS/TFS, and GitLab. Recently, I’ve switched to only using SSH for connecting to all my repos. Somewhere along the way though, I started to run into problems and flaky experiences.

For example, I finally tried Visual Studio’s new support for SSH-based Git authentication. But, Team Explorer would hang whenever I issued a Git command that required talking to the remote. Local commands worked fine, but doing fetches, pulls, or pushes always hung. I thought it was a bug in Team Explorer, as I had no problems with the same repo when using GitKraken instead. Then, Git Tower released their 1.0 version for Windows, and I decided to give it a shot as well. It also hung though. 

I then tried to do a fetch from Git bash and that’s when it finally became clear. It immediately asked if I wanted to store the server’s RSA2 fingerprint key in my cache. I hit the ‘y’ key, and nothing happened. Tried again, but still nothing. Tried ‘n’, and that didn’t work either. Some searching led me to the problem on Stack Overflow. Turns out there’s a bug in there somewhere, but it’s not in Visual Studio or Git Tower. It’s somewhere between Git and PuTTY/Pageant.

The workaround is to use the PuTTY application to add the server keys to my machine’s cache. To do so, I opened a new connection for each of the Git hosts I use. PuTTY immediately asked me the same question I got in bash, but it worked when using PuTTY’s GUI. Once the server keys were stored in my cache, everything worked once again.

Leave a Reply

Your email address will not be published. Required fields are marked *