3

I am trying to add an ssh key to the git ssh-agent in windows, from powershell. However, when I add it it adds it to the regular SSH agent but not the git one. I read this stackoverflow answer of it using a different SSH-agent. I tried starting the agent running C:\Program Files\Git\cmd> .\start-ssh-agent.cmd and it starts properly however when i try to do any ssh-add commands I get the error:

Error connecting to agent: No such file or directory

All the docs I have found is of adding the key to the .ssh file and then starting the ssh agent. is there a way to get files outside that directory in the Git SSH agent?

Igal Flegmann
  • 392
  • 1
  • 4
  • 17
  • Git just *runs* ssh, so it's more typical to use the system's ssh with Git, which makes the system's ssh-agent also work. I don't use Windows so I'm not sure when it might be reasonable to try to set up a whole separate ecosystem here, though. – torek Mar 27 '21 at 00:44
  • Git on windows does have their own system, I think it was because it was created before windows did ssh natively – Igal Flegmann Mar 27 '21 at 13:47

1 Answers1

3

From this issue I was able to find that you can change git to use the windows ssh agent by running the following command git config --global core.sshCommand "'C:\Windows\System32\OpenSSH\ssh.exe'"

Igal Flegmann
  • 392
  • 1
  • 4
  • 17