Skip to content

Instantly share code, notes, and snippets.

@SMUsamaShah
Last active March 10, 2026 09:18
Show Gist options
  • Select an option

  • Save SMUsamaShah/03f62e6ac95921f7e208a79a72bdaeef to your computer and use it in GitHub Desktop.

Select an option

Save SMUsamaShah/03f62e6ac95921f7e208a79a72bdaeef to your computer and use it in GitHub Desktop.
cmder ssh agent setup

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 agent folder

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment