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

标签 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.

这是什么意思?我该如何解决?

最佳答案

我刚刚遇到这个问题,发现您的问题正在尝试解决。我也假设它需要 .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/

相关文章:

git - git中commit命令的确切含义是什么

git - 在 Git 中测量/计数对象以查看我是否接近自动打包

git - 如何使用类似 curl 的命令获取远程仓库的最后一次提交 ID?

git - Capistrano + Git - "unable to find"[提交 SHA]

git - 在 Atom 中为 Linter 包安装包模块

git svn 忽略路径使用忽略文件

git - 如何检查 merge 提交是否包含手动更改(例如已解决的冲突)?

git - 如何从错误的 git push -f origin master 中恢复?

git rebase - 无法将 'pick' 更改为 'reword'

linux - 进行多次提交和一次推送与每次提交和推送之间有什么区别