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.

Managing SSH keys on Heroku

Heroku uses Git for your code repo, and therefore uses SSH to talk to the remote server. If you’re already using an SSH keypair for another repo or elsewhere, you may have to explicitly manage which of your key’s you want to use to access Heroku.

To list your current keys you’ve shared with Heroku:

heroku keys

To add a new key – run this from your ~/.ssh/ dir:

heroku keys:add keyfilename (e.g. rsa_id.pub)

If you get this error:

Fingerprint already exists. Please use one SSH key per Heroku account

… it’s because you’ve already used this SSH key with another account.