2

I have an RSA SSH key with a passphrase on Windows 11, with OpenSSH.

I tried to add it to the agent:

C:\code> ssh-add -k C:\Users\user\.ssh\id_rsa  
Enter passphrase for C:\Users\user\.ssh\id_rsa: 
Identity added: C:\Users\user\.ssh\id_rsa (C:\Users\user\.ssh\id_rsa)

I was hoping for it to prevent me type the passphrase each time I use the key.

Obviously, it is not working:

C:\code> git fetch
Enter passphrase for key '/c/Users/user/.ssh/id_rsa'

The agent is running:

Get-Service ssh-agent

Status   Name               DisplayName
------   ----               -----------
Running  ssh-agent          OpenSSH Authentication Agent

Do you have any idea on what can be investigated?

Thanks

4
  • 3
    Is your git using the same version of OpenSSH as ssh-add/ssh-agent? Your git maybe using its own build of OpenSSH, while you maybe using ssh-add from Win32-OpenSSH. Those are possibly incompatible. Jan 6, 2022 at 19:27
  • 2
    And even if they’re not incompatible, your Git SSH may not know about the running agent.
    – Daniel B
    Jan 6, 2022 at 19:40
  • Thanks, I did not think about that. Is there a way to ssh-add into the git agent ?
    – Xiiryo
    Jan 6, 2022 at 20:42
  • Interesting enough... If I use Git Bash instead of Power Shell... user@MYPC MINGW64 ~/OneDrive/Bureau (develop) $ ssh-add Could not open a connection to your authentication agent.
    – Xiiryo
    Jan 6, 2022 at 20:44

1 Answer 1

3

You can tell git which ssh executable it should use:

git config --global core.sshcommand "C:/Windows/System32/OpenSSH/ssh.exe"
1
  • If error: cannot spawn C:/Windows/System32/OpenSSH/ssh.exe: No such file or directory occurs, git config --global core.sshcommand "C:/Windows/SysNative/OpenSSH/ssh.exe" works
    – dolgom
    Jan 16, 2023 at 13:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .