For me, ssh-add
was running the "wrong" command.
On my windows system, there were 2 ssh-add
programs - Git's one, and the OpenSSH one that is included with Windows.
Git's one requires the ssh-agent to be started manually with the command line. The OpenSSH one uses the Windows service "OpenSSH Authentication Agent".
For me, this guide https://blog.devgenius.io/how-to-add-private-ssh-key-permanently-in-windows-c9647ebfca3e got me nearly where I needed to be, but that was only part of the puzzle - the missing piece was understanding that I actually had TWO ssh agents installed, and I needed to ensure I was trying to connect to the correct one:
Type where ssh-add
to confirm which ssh-add will be invoked when you run the command:
c:\projects\keypay-dev\Basics\Payroll\Payroll>where ssh-add
C:\Windows\System32\OpenSSH\ssh-add.exe
c:\program files\Git\usr\bin\ssh-add.exe
This is how it should look if you want to use the Windows one, and thus benefit from the Windows service and not have to start it from the command line every session.
If the one in the Git folder is above, as it was for me before I corrected it, move C:\Windows\System32\OpenSSH
to higher than c:\program files\Git\usr\bin
in your PATH
variable.