fri*_*zmg 8 windows git git-bash scoop-installer
我在 Windows 10 x64 上使用设置,我通过 scoop 安装和管理 git,而不是自己下载和执行安装程序。通过PowerShell,我跑了
scoop install git
scoop install openssh
[environment]::setenvironmentvariable('GIT_SSH', (resolve-path (scoop which ssh)), 'USER')
Run Code Online (Sandbox Code Playgroud)
但是,现在当我尝试运行的命令在Git的Bash的喜欢
git clone git@example.org:vendor/repository.git
Run Code Online (Sandbox Code Playgroud)
或者一个简单的
git push/pull
Run Code Online (Sandbox Code Playgroud)
我只得到
CreateProcessW failed error:193
ssh_askpass: posix_spawn: Unknown error
Run Code Online (Sandbox Code Playgroud)
而不是 Git Bash 询问我的 SSH 密钥密码。
我在许多其他 Windows 10 x64 上使用相同的设置(通过 scoop 安装的 git)并且那里没有出现问题。所以我不确定这个问题出了什么问题。我以前在同一台机器上安装了 git 而不使用 scoop,并且 Git Bash 运行良好。在通过scoop重新安装它之前,我完全卸载了 git(并且还重新启动了机器,只是为了确定)。
如果相关,SSH_ASKPASS环境变量包含以下内容:
$ echo ${SSH_ASKPASS}
/mingw64/libexec/git-core/git-gui--askpass
Run Code Online (Sandbox Code Playgroud)
不确定那个文件夹指的是什么(大概是Git Bash内部的东西?),因为它在我的机器上显然不存在。
当使用git-with-openssh而不是单独git和openssh单独使用它时。但是,我没有在我的其他机器上使用它,所以我仍然想知道为什么它在这里不起作用。
我很确定我的回答没有解决OP的原始案例。但截至 2020 年,似乎存在类似的问题,但有不同的解决方法,这就是我在我的案例中所做的。
部分问题是,现在 Windows 10 有自己的 OpenSSH 版本,至少在我工作的机器上,该选项似乎默认启用。
不过,这个捆绑的 OpenSSH 与 Git bash 不兼容,所以如果你想使用它,你必须强制 git 使用 scoop 提供的 OpenSSH(来自openssh或git-with-openssh包)。这意味着覆盖GIT_SSH环境变量,例如通过在 .bashrc 中添加与此类似的行:
export GIT_SSH='C:\Users\rogs\scoop\apps\git-with-openssh\current\usr\bin\ssh.exe'
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你。