git ssh 身份验证失败,ssh_askpass: posix_spawn: Unknown error [英] git ssh authentication fails with ssh_askpass: posix_spawn: Unknown error

查看:73
本文介绍了git ssh 身份验证失败,ssh_askpass: posix_spawn: Unknown error的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 10 x64 上使用设置,我通过 scoop 安装和管理 git,而不是自己下载和执行安装程序.通过PowerShell,我跑了

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')

但是,现在当我尝试在 Git Bash 中运行命令时,例如

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

git clone git@example.org:vendor/repository.git

或者简单的

git push/pull

我只知道

CreateProcessW failed error:193
ssh_askpass: posix_spawn: Unknown error

而不是 Git Bash 询问我的 SSH 密钥密码.

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

我在许多其他 Windows 10 x64 上使用相同的设置(通过 scoop 安装的 git)并且没有出现任何问题.所以我不确定这个问题出了什么问题.我以前在同一台机器上安装了 git 而不使用 scoop,并且 Git Bash 运行良好.在通过 scoop 重新安装它之前,我完全卸载了 git(并且还重新启动了机器,只是为了确定).

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.

SSH_ASKPASS 环境变量包含以下内容,以防万一:

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

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

不确定那个文件夹指的是什么(大概是 Git Bash 内部的东西?),因为它在我的机器上显然不存在.

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.

当使用git-with-openssh 而不是 gitopenssh 分别工作.但是,我没有在我的其他机器上使用它,所以我仍然想知道为什么它在这里不起作用.

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.

推荐答案

我很确定我的回答没有解决 OP 的原始案例.但到 2020 年,似乎有一个类似的问题,但解决方法不同,这就是我的案例.

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.

问题的一部分是,现在 Windows 10 具有 其自己版本的 OpenSSH 可用,至少在我工作的机器的情况下,该选项似乎默认启用.

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.

这个捆绑的 OpenSSH 与 Git bash 不兼容,所以如果你想使用它,你必须强制 git 使用 scoop 提供的 OpenSSH(来自 opensshgit-with-openssh 包).这意味着覆盖 GIT_SSH 环境变量,例如通过在 .bashrc 中添加与此类似的行:

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'

希望有帮助.

这篇关于git ssh 身份验证失败,ssh_askpass: posix_spawn: Unknown error的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆