DEV Community

Cover image for How to enable OpenSSH Agent to access your github repositories on Windows PowerShell
Anoop AK
Anoop AK

Posted on

How to enable OpenSSH Agent to access your github repositories on Windows PowerShell

If you are someone coming from a Linux/Mac developer environment to Windows, you would be missing your old friends ssh-agent and ssh-add that are commonly used for authentication while using the SSH protocol for Git.

While WSL2 grants you access to a native Linux environment that you are used to, there would be few who prefer to use PowerShell to accomplish some of the tasks. If you are one of them, read on...

For PowerShell users, previously you had to install OpenSSHUtils to get access to ssh-agent. Windows 10 already ships with OpenSSH Authentication Agent, which is disabled by default. Hence, if you execute ssh-agent in PowerShell, you will get the following error.

unable to start ssh-agent service, error :1058

It's just the matter of enabling the service either from PowerShell(as Admin) or from Services.

Enabling SSH Agent using PowerShell

PowerShell should be run as Administrator to be able to execute the below steps



Set-Service -Name ssh-agent -StartupType Automatic
Set-Service -Name ssh-agent -Status Running


Enter fullscreen mode Exit fullscreen mode

Enabling SSH agent from Services

  • Open Services(Start Menu -> Type "Services")
  • Select OpenSSH Authentication Agent Alt Text
  • Set StartupType to Automatic Alt Text

That's it!
You should now be able to execute ssh-keygen, ssh-agent, and ssh-add from PowerShell.



PS C:\Users\anoop> ssh-add
Enter passphrase for C:\Users\anoop/.ssh/id_rsa:
Identity added: C:\Users\anoop/.ssh/id_rsa (anoop@DESKTOP-ABCD123)


Enter fullscreen mode Exit fullscreen mode

Top comments (0)