The SSH Agent allows you to remember the password for a password protected SSH private key during your session. While Linux usually is able to handle this rather elegantly using it’s key stores like the gnome-keyring (for KDE I think it’s still disappointingly complicated), in Windows it’s still a bit of a second class citizen.
My Windows workflow usually involves some Git in Emacs (magit) and Powershell usage, so here’s a configuration that initializes the SSH Agent when you start a Powershell session.
In %HOMEPATH%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 is have:
It loads posh-git and then loads the SSH Agent and stores the output into a file. Then we use this file to load the running SSH Agent in subsequent Powershell sessions.
Then in emacs I can read this file and set the environment variables in place in my .emacs:
That’s it! Now Emacs is able to use the SSH Agent to use SSH keys.