Semi-passwordless SSH agent configuration in Powershell
Configuring the SSH agent to start as a Windows server and only ever enter your SSH keys password once.
I dont use windows at all now. You could probably get a better answer from ChatGPT, presuming it doesn’t use this to generate a response.
This is something that I normally have to do before I have my documentation available, so I’m quickly scribbling this down.
Fresh Windows install; no ssh agent? Ez fix.
Thanks to (https://lejencodes.com/using-ssh-agent-with-visual-studio-code-on-windows-10/)
Set-Service ssh-agent -StartupType Automatic
Start-Service ssh-agent
Get-Service ssh-agent
To add an SSH key you can just run ssh-add <path to key> however that’s for scrub losers. Running commands? Sounds like doing work… not in my devops role!
Update your SSH config (ez mode is to run code.cmd ~/.ssh/config) and alter your Host * block to include the AddKeysToAgent yes line as I have below:
Host *
AddKeysToAgent yes
Provided that OpenSSH can see the agent, you will only be asked for each password once and never again. Credit where it is due; this is easier behavior to configure in powershell than it is in bash.