Assuming you set up PGP (GPG) on your YubiKey, all you need to do is:

  1. Install Gpg4win from here.
  2. Install PuTTY from here.
  3. Tell git to use it (CMD):
git config --global core.sshcommand "plink -agent"

4. Edit or create %appdata%\gnupg\gpg-agent.conf with the following contents:

default-cache-ttl 600
max-cache-ttl 7200

5. Start or restart the GPG agent (CMD):

gpg-connect-agent.exe killagent /bye
gpg-connect-agent.exe /bye

6. Cache the GitHub key (or whatever host you use) (CMD):

plink -agent -v [email protected]

That’s all there is to it! Make sure to check out the previous guide on how to sign git commits with your YubiKey!

Note, if your prompt freezes asking to cache the key, hit CTRL+C to abort and run this command: plink -agent -v [email protected] then try again.

PS It’s amazing how bad the official YubiKey documentation is.