git commit error with sublime text 2 [duplicate]

 ̄綄美尐妖づ 提交于 2020-01-22 16:18:45

问题


I'm taking the course "How to Use Git and GitHub" on Udacity. I'm following along with the examples but I've run into a problem. I've been at it trying to fix the problem via googling and trial and error by myself for about two hours. I think it's about time to make a StackOverflow post. I prefer trying to figure out my issue without posting on StackOverflow, but it seems at this point, I'm not being productive and I'm sure this issue is a gotcha for a more experienced developer and I could save hours by posting here, so here I am. I've found forum posts on varying sites with similar issues to mine and have followed the appropriate action to no avail. I would appreciate any help or guidance.

So, we are learning about git and doing our first git commit. I'm on Windows 7. I'm using Git Bash to navigate through the directories on my computer and to do git commands. The course had us set the default editor for Git to be Sublime Text 2 with the command...

git config --global core.editor "'C:/Program Files/Sublime Text2/sublime_text.exe' -n -w"

Now, I navigate to the appropriate directory using Git Bash and then I do a git status and it shows the two files I want in the staging area. All is fine and well. But as soon as I try to do a git commit, I get the following error...

'C:/Program Files/Sublime Text2/sublime_text.exe' -n -w: C:/Program Files/Sublim
e Text2/sublime_text.exe: No such file or directory
error: There was a problem with the editor ''C:/Program Files/Sublime Text2/subl
ime_text.exe' -n -w'.
Please supply the message using either -m or -F option.

Please help!!!

Thanks in advance for your time and efforts :)


回答1:


I am also taking the same course from udacity and have the same errors . I figured out that the path in .gitconfig file includes slashes before space but they aren't needed . Go to the .gitconfig file , you will find your path as C:/Program Files/Sublime\\ Text\\ 2/sublime_text.exe . Just remove the slashes and make it C:/Program Files/Sublime Text 2/sublime_text.exe.

Now the error of providing message using -m will go away and sublime will open on entering git commit




回答2:


I fixed my problem by editing the editor value in the .gitconfig file to match the one suggested by @awayken on this StackOverflow post How can I make Sublime Text the default editor for Git?. I'm not sure why, but this seems to have resolved the issue for now.



来源:https://stackoverflow.com/questions/27241099/git-commit-error-with-sublime-text-2

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