DEV Community

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

Posted on

6 2

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

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay