运行 git commit 时与编辑器相关的错误?

use*_*776 4 git git-commit

运行 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.
Run Code Online (Sandbox Code Playgroud)

这是什么意思?我该如何修复它?

Mic*_*olm 5

我刚刚遇到这个问题,发现你的问题试图弄清楚。我也认为 .gitconfig 中的空格和括号需要转义字符,但显然不需要。这个声明对我有用:

editor = C:/Program Files (x86)/Notepad++/notepad++.exe
Run Code Online (Sandbox Code Playgroud)

这是通过以下命令在我的 .gitconfig 文件中创建的:

git config --global core.editor /c/Program\ Files\ \(x86\)/Notepad\+\+/notepad\+\+.exe
Run Code Online (Sandbox Code Playgroud)

我必须删除无效的行,然后才能使用上述命令进行设置。

不幸的是,git commit 仍然不起作用。在它周围添加引号和单引号终于起作用了,在我正在运行的 Notepad++ 窗口中启动 COMMIT_EDITMSG:

editor = "'C:/Program Files (x86)/Notepad++/notepad++.exe'"
Run Code Online (Sandbox Code Playgroud)

平台是 Windows 8.1 Pro x64,MINGW64/Bash shell,从https://git-scm.com Windows 客户端安装。