gitgit-bashssh-agent

Adding SSH keys to SSH-Agent in Git Windows


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?


Solution

  • 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'"