This assumes you already have a private key created through puttygen.exe.
Download Putty
Go to the install directory and right click on Pagent.exe and create a shortcut.
Right click on the Properties of the shortcut and update the Target:
"C:\Program Files\PuTTY\pageant.exe" "PATH_TO_YOUR_PRIVATE KEY(.ppk)"
- Copy your shortcut to the Startup folder:
COPY your_pagent_shortcut %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup
- Set a system environment variable for GIT_SSH with the value as the path to plink.exe:
SETX GIT_SSH "C:\Program Files\PuTTY\plink.exe"
Update: 08-11-2024
The latest version of Putty/Plink/Pagent (0.81+) do not seem to require the step 5.
- When first running any git commands via terminal/console you may be prompted with:
git pull
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's ecdsa-sha2-nistp256 key fingerprint is:
ecdsa-sha2-nistp256 256 3d:98:22:58:ca:cc:ec:f9:7f:25:3f:67:a9:03:36:70
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n)
Unfortunately, this may hang the console until you press ctrl-c.
You can work around this by opening the GUI for putty.exe and set the hostname to your git repository (github.com). You'll be prompted with the same message through the GUI which you can except.
Alternatively:
echo y | plink.exe -ssh root@YOUR_GIT_REPO_IP "exit"
References: