Enable the Windows ssh-agent Service

The OpenSSH agent exists on Windows but ships disabled — three PowerShell lines make passphrases painless.

WindowssshgitserviceLow risk
Set the ssh-agent service to Automatic, start it, then load your key with ssh-add.

01Command

Command
$ Get-Service ssh-agent | Set-Service -StartupType Automatic ; Start-Service ssh-agent ; ssh-add $env:USERPROFILE\.ssh\id_ed25519

02What it does

Unlike Linux, Windows ships the ssh-agent service with startup type Disabled, so ssh-add fails with 'could not open a connection' until you enable it. Setting it to Automatic means the agent holds your decrypted keys from sign-in onward, so git push and ssh stop prompting for the passphrase. The agent on Windows can also be used by tools like WSL via the optional bridge, and keys are stored under the Windows key store rather than a socket file.

03Risk

RiskLow risk
RequirementsRequires an elevated PowerShell to change the service startup type; OpenSSH client installed

04Undo

Undo
$ Set-Service ssh-agent -StartupType Disabled ; Stop-Service ssh-agent

05Sources

  • SSH key management for OpenSSH on Windows
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: Documents enabling the ssh-agent Windows service via Set-Service and loading keys with ssh-add, exactly as in this command.

Last verified: 2026-09-17 · Category: Developer