简体   繁体   English

Windows版Git,将GIT_SSH设置为外壳文件会导致“错误:无法生成 <path> : 没有相应的文件和目录”

[英]Git for Windows, setting GIT_SSH to a shell file causes causes “error: cannot spawn <path>: No such file or directory”

On Windows 10 , using Git-2.4.6-5th-release-candidate-64-bit.exe , if I do: Windows 10 ,如果执行以下操作,请使用Git-2.4.6-5th-release-candidate-64-bit.exe

set GIT_SSH=D:\ssh.sh

I get: 我得到:

error: cannot spawn D:\ssh.sh: No such file or directory
fatal: unable to fork

But if I instead do: 但是,如果我改为:

set GIT_SSH=D:\ssh.exe

or: 要么:

set GIT_SSH=D:\ssh.bat

everything works as intended. 一切都按预期进行。

My PATHEXT : 我的PATHEXT

PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.sh

A registry file that has been applied: 已应用的注册表文件:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\Applications\bash.exe]
[HKEY_CURRENT_USER\Software\Classes\Applications\bash.exe\shell]
[HKEY_CURRENT_USER\Software\Classes\Applications\bash.exe\shell\open]
[HKEY_CURRENT_USER\Software\Classes\Applications\bash.exe\shell\open\command]
@="\"C:\\sdk\\Git\\bin\\bash.exe\" \"%1\" %*"

[HKEY_CURRENT_USER\Software\Classes\Applications\sh.exe]
[HKEY_CURRENT_USER\Software\Classes\Applications\sh.exe\shell]
[HKEY_CURRENT_USER\Software\Classes\Applications\sh.exe\shell\open]
[HKEY_CURRENT_USER\Software\Classes\Applications\sh.exe\shell\open\command]
@="\"C:\\sdk\\Git\\bin\\sh.exe\" \"%1\" %*"

[HKEY_CLASSES_ROOT\sh_auto_file]
[HKEY_CLASSES_ROOT\sh_auto_file\shell]
[HKEY_CLASSES_ROOT\sh_auto_file\shell\open]
[HKEY_CLASSES_ROOT\sh_auto_file\shell\open\command]
@="\"C:\\sdk\\Git\\bin\\sh.exe\" \"%1\" %*"
[HKEY_CLASSES_ROOT\sh_auto_file\ShellEx]

[HKEY_CLASSES_ROOT\.sh]
@="sh_auto_file"

[HKEY_CLASSES_ROOT\.sh\DefaultIcon]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,69,00,6d,00,\
  61,00,67,00,65,00,72,00,65,00,73,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,36,\
  00,38,00,00,00

[HKEY_CLASSES_ROOT\.sh\shell\edit]

[HKEY_CLASSES_ROOT\.sh\shell\edit\command]
@="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\" \"%1\""

The result of these is that if I open up cmd and enter: 这些的结果是,如果我打开cmd并输入:

D:\ssh.sh

or even: 甚至:

D:\ssh

the script is executed. 脚本被执行。

But git refuses to use the shell script, but is content to use .exe files and .bat files. 但是git拒绝使用shell脚本,但满足于使用.exe文件和.bat文件。

Why is this? 为什么是这样? Is it a bug, or am I missing something? 是一个错误,还是我缺少了什么?

For some totally unexplained reason, I can verify that NOW it works in both cmd and git bash whilst it didn't before. 由于某些完全无法解释的原因,我可以验证它现在在cmdgit bash中都可以运行,而以前却没有。

Now on to creating a git-repo preprocessor for ssh so multi-account users have it easier. 现在开始为ssh创建git-repo预处理程序,以便多帐户用户更轻松。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有钩子的 msysgit 错误:“git 错误:无法生成 .git/hooks/post-commit:没有这样的文件或目录” - msysgit error with hooks: "git error: cannot spawn .git/hooks/post-commit: No such file or directory" 用于Windows的Git SSH客户端和.ssh / config文件的错误路径 - Git SSH client for windows and wrong path for .ssh/config file Ruby on Windows导致错误无法加载此类文件bcrypt_ext - Ruby on windows causes error Cannot load such file bcrypt_ext Python - Windows - Popen(shlex.split(command), shell=False 导致 OSError: [Errno 2] 没有这样的文件或目录 - Python - Windows - Popen(shlex.split(command), shell=False causes OSError: [Errno 2] No such file or directory 无法在Windows中使用git(此类文件没有此类文件或目录) - Cant use git in windows (Such file no such file or directory) 错误:无法运行 ssh:尝试在 windows 上克隆时没有此类文件或目录 - error: cannot run ssh: No such file or directory when trying to clone on windows git-bash $PATH 无法解析带空格的 windows 目录 - git-bash $PATH cannot parse windows directory with space 在Windows下克隆git repo时我得到“错误:无法创建文件<file> ...(是一个目录)” - When cloning git repo under Windows I get “error: unable to create file <file>… (Is a directory)” Windows、Git 和 SSH 裸存储库的 URL/路径 - Windows, Git and the SSH url/path of a bare repository 在Windows下使用带有SSH密钥文件的GIT时出现问题 - Problems using GIT w/ SSH key file under Windows
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM