Table of Contents

Windows SSH Agent

1. SSH Agent Powershell

1.1 Git in powershell

Run PS as Admin

Type command ssh-agent, if you face error message like unable to start ssh-agent service, error :1058 then you need to fix it. Run this Set-Service ssh-agent -StartupType Manual to fix the error. This command tell that to set service of ssh-agent and I set to start ssh-agent to manual because I want to use it when I need it. You can use Set-Service ssh-agent -StartupType Automatic if you wish so.

After that

ssh-add ~\.ssh\private.key

1.2 prerequisites

Windows ssh is stopped

 Get-Service ssh-agent
 Status   Name               DisplayName
 ------   ----               -----------
 Stopped  ssh-agent          OpenSSH Authentication Agent

Install post-git

PowerShellGet\Install-Module posh-git -Scope CurrentUser -Force

1.3 how to

You can get the ssh-agent running using the command that comes with Git for Windows in powershell:

 start-ssh-agent.cmd

That will start up the ssh-agent. start-ssh-agent.cmd sets the variable SSHAUTHSOCK, which is required by ssh-add, but this variable cannot be accessed outside this CMD shell. Therefore, ssh-add needs to run inside this CMD shell.

Then you can add your key with

 ssh-add ~/.ssh/namneOfPrivateKey