Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git ssh authentication fails with ssh_askpass: posix_spawn: Unknown error

I am using a setup on Windows 10 x64 where I install and manage git via scoop, rather downloading and executing the installer myself. Via the PowerShell, I ran

scoop install git
scoop install openssh
[environment]::setenvironmentvariable('GIT_SSH', (resolve-path (scoop which ssh)), 'USER')

However, now when I try to run commands in the Git Bash like

git clone [email protected]:vendor/repository.git

or a simple

git push/pull

I only get

CreateProcessW failed error:193
ssh_askpass: posix_spawn: Unknown error

instead of the Git Bash asking me for my SSH key's passphrase.

I am using the same setup (git installed via scoop) on many other Windows 10 x64 and no problems occur there. So I am not sure what is going wrong on this one. I previously had git installed without scoop on the same machine and the Git Bash was working fine. I uninstalled git completely (and also restarted the machine, just to be sure) before re-installing it via scoop instead.

The SSH_ASKPASS environment variable contains the following, in case this is relevant:

$ echo ${SSH_ASKPASS}
/mingw64/libexec/git-core/git-gui--askpass

Not sure what that folder refers to (something internal to the Git Bash presumably?), since it obviously does not exist like that on my machine.

Update

When using git-with-openssh instead of just git and openssh separately it works. However, I don't use that on my other machines, so I'd still like to know why it's not working here.

like image 899
fritzmg Avatar asked Dec 05 '18 16:12

fritzmg


2 Answers

I'm pretty sure my answer does not address the OP's original case. But as of 2020, there seems to be a similar issue with a different way of solving it, and that's how I did in my case.

Part of the problem is, now Windows 10 has its own version of OpenSSH available, and at least in the case of my work's machine it seems that option is enabled by default.

This bundled OpenSSH is not compatible with Git bash though, so if you wants to use it, you must force git use scoop's provided OpenSSH (either from openssh or git-with-openssh packages). That means overwriting GIT_SSH environment variable, e.g. by adding a line similar to this to your .bashrc:

export GIT_SSH='C:\Users\rogs\scoop\apps\git-with-openssh\current\usr\bin\ssh.exe'

Hope it helps.

like image 105
rsenna Avatar answered Sep 17 '22 17:09

rsenna


Even if this topic is already very old, the problem persists. I found out that its enough to simply unset the environment variable to get rid of this error.

unset SSH_ASKPASS

Just put this in your .bash_profile and/or your .bashrc.

like image 29
Ruben Avatar answered Sep 18 '22 17:09

Ruben