October 23, 2021


A blog for USEFUL-IT information

PoSH-Git : unable to start ssh-agent service, error :1058

Hi all,

Just ran into an issue that the SSH-Agent is unable to start from PowerShell with the PoSH-Git module.

After some digging I found out that Microsoft has installed their own SSH-agent with Windows 10 April 2018 Update.

I ran the following command

*NOTE: Run these commands in administrative PowerShell window

Get-command ssh-agent

CommandType Name Version Source
----------- ---- ------- ------
Application ssh-agent.exe C:\WINDOWS\System32\OpenSSH\ssh-agent.exe

It showed me that an SSH-Agent is installed on the system but not in the folder that I expected. (C:\Program Files\Git\usr\bin\ssh-agent.exe)

But in c:\windows\system32\OpenSSH

I opened the folder c:\windows\system32\OpenSSH and much to my surprise all the required applications where there.


I ran the following command to see if a service is available, much to my surprise there was.

Get-service ssh-agent | Select *

Name : ssh-agent
RequiredServices : {}
CanPauseAndContinue : False
CanShutdown : False
CanStop : False
DisplayName : OpenSSH Authentication Agent
DependentServices : {}
MachineName : .
ServiceName : ssh-agent
ServicesDependedOn : {}
ServiceHandle :
Status : Stopped
ServiceType : Win32OwnProcess
StartType : Disabled
Site :
Container :

As you can see the StartType is ‘Disabled’ so it is not allowed to start the Service and therefor also not starting the ssh-agent.exe

I ran the following command to change the StartType

Get-service ssh-agent | Set-Service -StartupType Manual

I then closed my powershell windows and opened it again, and my posh-git module loaded successfully.

When I checked the running applications I also found that the SSH-Agent has been started
Get-Process ssh-agent

Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
88 8 1332 5204 12604 0 ssh-agent

I also found that the ssh-agent was running under PID 12604.

Ran the next command :
Get-service ssh-agent

Status Name DisplayName
------ ---- -----------
Running ssh-agent OpenSSH Authentication Agent

And found out that the service was started.

Problem solved.