Cygwin, git and ssh: ‘cannot spawn c:cygwinbinssh’

Using Cygwin and git on windows, I ran into an issue where git was working fine in a cygwin shell, but I was trying to setup a Jenkins build accessing a git repo, and git from Windows was giving errors like this:

$ git push myremote master
error: cannot spawn c:cygwinbinssh: No such file or directory
fatal: unable to fork

Running shell commands on Windows in Cygwin this was somewhat misleading, as I wasn’t expecting it to be looking for ‘ssh.exe’.

Turns out my GIT_SSH env var was causing the issue, had to replace this:

GIT_SSH=c:cygwinbinssh

with

GIT_SSH=c:cygwinbinssh.exe

and then all was good.