First make sure ssh-agent service is running.
In my taskmanager, it is showing up as ssh-agent.exe.
This is running from C:\Windows\System32\OpenSSH\ssh-agent.exe
In cmder check which ssh-agent is being used
λ which ssh-agent
/c/WINDOWS/System32/OpenSSH/ssh-agent
and which ssh-add
λ which ssh-add
/c/WINDOWS/System32/OpenSSH/ssh-add
We just need to ssh-add the key
ssh-add C:\Users\myname\.ssh\id_rsa
Error connecting to agent: No such file or directory
The file is there.
This error likely means that an agent is already setup but incorrectly or wrong path.
Let's clear that one
echo %SSH_AUTH_SOCK%
/c/Users/myname/.ssh/agent/s.aGBNlxTtpZ.agent.81zvuVDQa7
- Remove this
agentfolder
Also clear the %SSH_AUTH_SOCK% env var
λ set SSH_AUTH_SOCK=
Now ssh-add again
λ ssh-add.exe c:\users\myname\.ssh\id_rsa
Enter passphrase for c:\users\myname\.ssh\id_rsa:
Identity added: c:\users\myname\.ssh\id_rsa (c:\users\myname\.ssh\id_rsa)
It now works