Error related to editor when running git commit?

旧时模样 提交于 2019-12-01 18:42:56

I was just running into this, and found your question trying to figure it out. I too assumed it needed escape characters for the spaces and parentheses IN .gitconfig, but apparently not. This statement worked for me:

editor = C:/Program Files (x86)/Notepad++/notepad++.exe

Which was created in my .gitconfig file by the below command:

git config --global core.editor /c/Program\ Files\ \(x86\)/Notepad\+\+/notepad\+\+.exe

I had to remove the invalid line, before setting it with the above command would work.

Unfortunately, git commit still didn't work. Adding both Quotation marks and single quotes around it finally worked, launching the COMMIT_EDITMSG in my running Notepad++ window:

editor = "'C:/Program Files (x86)/Notepad++/notepad++.exe'"

Platform is Windows 8.1 Pro x64, the MINGW64/Bash shell, installed from the https://git-scm.com Windows client.

Looks like the prepare-commit-msg hook or the editor option in the gitconfig has a typo. You call c:/Program/ Files/ /(x86/)/Notepad++/notepad++.exe but you should have called c:/Program\ Files\ \(x86\)/Notepad++/notepad++.exe (use backslashes to escape space and bracket, not slash)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!