I am trying to use the Sublime Text 3 as the git editor. Meanwhile, I am using the Mac and the default shell is "zsh"
I use the following code to configure the editor
(base) jake@JakedeMacBook-Pro ~ % git config --global core.editor "'/Users/jake/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl' -n -w"
However, when I add the commit, I meet the following failure:
(base) jake@JakedeMacBook-Pro new-git-project % git commit
'/Users/jake/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl' -n -w: /Users/jake/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl: No such file or directory
error: There was a problem with the editor ''/Users/jake/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl' -n -w'.
Please supply the message using either -m or -F option.
I also checked the Sublime Text path and am sure the "/Users/jake/Applications/Sublime\ Text.app/" is right.
I don't know how to fix this problem. Hope someone can help me.
I suspect there're too many escaping in your path to the editor. It should be either apostrophes or backslash but not both. I.e. either
git config --global core.editor "'/Users/jake/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl' -n -w"
or
git config --global core.editor "/Users/jake/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n -w"
When you use both apostrophes and backslash the path to the editor becomes '/Users/jake/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl'
which is wrong. Try yourself from the command line running the editor using paths
'/Users/jake/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl'
'/Users/jake/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl'
/Users/jake/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl
The first one should give an error, the two other should run the editor.