How to Configure Git SSH for Pageant Authentication
The other day, I had trouble cloning a GitHub repository using PowerShell. I use SourceTree as my Git GUI, and it was working fine. However, cloning via the command line just wasn't working.
I eventually discovered that my system Git was using a different SSH application than SourceTree. I was able to clone the repository using SourceTree's MinGW terminal.
From the StackOverflow article linked below, I learned that I should set the PuTTY Plink application as Git's default SSH app. So, I went to Windows 11 Settings -> System -> About -> Advanced System Settings -> Environment Variables. There, I added a new system environment variable by clicking the "New" button.
Next, I verified that the environment variable was set by opening a new (important!) PowerShell window and running the $Env:GIT_SSH
command. The result confirmed that it was working.
Now, I should have been able to add keys via Pageant and use them with Git. Pageant is another PuTTY app for managing SSH keys, and SourceTree also uses it for authentication. Here's a screenshot of the app:
I navigated to my <user>\source\repos
directory in PowerShell and tried to clone a private repository. It worked! Here's a screenshot of the result:
Using Pageant with Git via the command line requires some setup, but it's definitely worth it.
Sources:
Subscribe to my newsletter
Read articles from Maija Kekkonen directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by