Setting up sublimetext 3 as git commit text editor

You can solve this by putting in a full path

git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n -w"

Source: OS X Command Line

EDIT: If the name of the app is not Sublime Text.app you will want to replace that with the correct name.


For what it's worth, here's how I solved it:

1) Run in Terminal:

sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl

This adds a subl alias to /usr/local/bin/ pointing to Sublime Text 3 app’s binary file. Now running subl in Terminal will launch Sublime Text 3 app.

2) Run in Terminal:

git config --global core.editor "subl -n -w"

This adds editor = subl -n -w to the [core] section of the ~/.gitconfig file. Now running git commit in Terminal will launch Sublime Text 3 app (subl) in a new window (-n), and the command line will wait (-w) until the commit message is saved and closed.

Image of final workflow added in response to clarifying question in comments below:

enter image description here

Official Sublime Text 3 doc: http://www.sublimetext.com/docs/3/osx_command_line.html