If you are someone coming from a Linux/Mac developer environment to Windows, you would be missing your old friends
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.
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
- Open Services(Start Menu -> Type "Services")
- Select OpenSSH Authentication Agent
- Set StartupType to Automatic
You should now be able to execute
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)