Search code examples
gitopensshssh-agent

Specify which SSH to use


I am using windows 10 with OpenSSH, Git installed. Now I have setup to use ssh key for git communication. I used ssh-add to add key in ssh-agent. The problem is git uses its own local ssh-agent and I have added a key in windows open ssh-agent. Running where ssh-agent returns two different location.

C:\Program Files\Git\usr\bin\ssh-agent.exe
C:\Windows\System32\OpenSSH\ssh-agent.exe

I would like to specify in git which ssh-agent to use.


Solution

  • You can set the environment variable GIT_SSH to the path of the OpenSSH executable (C:\Windows\System32\OpenSSH\ssh.exe). After this, Git should use the ssh-agent of OpenSSH.