运行 Git commit 时出现以下错误:
c:/Program/ Files/ /(x86/)/Notepad++/notepad++.exe: -c: line 0: syntax
error near unexpected token `('
c:/Program/ Files/ /(x86/)/Notepad++/notepad++.exe: -c: line 0: `c:/Pr
ogram/ Files/ /(x86/)/Notepad++/notepad++.exe \$@\'
error: There was a problem with the editor 'c:/Program/ Files/ /(x86/)
/Notepad++/notepad++.exe'.
Please supply the message using either -m or -F option.
这是什么意思?我该如何解决?
最佳答案
我刚刚遇到这个问题,发现您的问题正在尝试解决。我也假设它需要 .gitconfig 中的空格和括号的转义字符,但显然不需要。这句话对我有用:
editor = C:/Program Files (x86)/Notepad++/notepad++.exe
这是通过以下命令在我的 .gitconfig 文件中创建的:
git config --global core.editor /c/Program\ Files\ \(x86\)/Notepad\+\+/notepad\+\+.exe
我必须先删除无效行,然后才能使用上述命令对其进行设置。
不幸的是,git commit 仍然没有工作。添加引号和单引号终于奏效了,在我运行的 Notepad++ 窗口中启动 COMMIT_EDITMSG:
editor = "'C:/Program Files (x86)/Notepad++/notepad++.exe'"
平台是 Windows 8.1 Pro x64,MINGW64/Bash shell,从 https://git-scm.com 安装Windows 客户端。
关于git - 运行 git commit 时与编辑器相关的错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28294375/