-
-
Save S3ak/10427958 to your computer and use it in GitHub Desktop.
Method 1 | |
git config --global core.editor "'c:/program files/sublime text 3/sublime_text.exe' -w" | |
Method 2 | |
git config --global core.editor "subl -n -w" | |
Method 3 | |
$ echo 'alias subl="/cygdrive/c/Program\ Files/Sublime\ Text\ 3/sublime_text.exe"' >> ~/.bashrc |
@LiubovT subl: command not found
means you don't have a symlink for the subl
command. You can add this symlink per the directions here.
The only change I would make to those directions is rather than adding the symlink to ~/bin
I would add the symlink to /usr/local/bin
. So the command would be:
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
^ I've found this to be the most durable option (on MacOS).
Step one
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
Step two
git config --global core.editor "subl -n -w"
Now you should be able to use Sublime text for git stuff like editing commit messages for reverts/squashes/etc.
@okor thank you!
^ I've found this to be the most durable option (on MacOS).
Step one
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
Step two
git config --global core.editor "subl -n -w"
Now you should be able to use Sublime text for git stuff like editing commit messages for reverts/squashes/etc.
It finally works! Thanks a lot @okor
Thanks!
I have no idea why this is still active. I switched to vs-code. I'm closing this gist.
For Mac
Try This : git config --global core.editor "/Applications/Sublime\ Text.app/Contents/MacOS/Sublime\ Text"
Then Check : git config --global -e
Make sure you include the path in double quotes.This works for me TOO!!!!!!!Thanks @pranitkokne
yes double quote works (y) thanks
I've sent hours trying to figure this out and nothing from the list above is working. I keep on getting this message, yet I am able to launch sublime with just subl alias, but when I try to commit or merge this message pops up. I am confused, does my alias even work or not?
hint: Waiting for your editor to close the file... subl -n -w: subl: command not found
error: There was a problem with the editor 'subl -n -w'.
Please supply the message using either -m or -F option.
How did you eventually solve this cos I'm having that exact problem
This worked for me (Mac):
git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n -w"
Hope it helps you :D
Using @pranitkokne's answer, git commit
opens up a new tab in Sublime, but the prompt is not returned until I quit the editor completely. Saving and closing the tab isn't enough.
For Mac
Try This : git config --global core.editor "/Applications/Sublime\ Text.app/Contents/MacOS/Sublime\ Text"
Then Check : git config --global -e
Make sure you include the path in double quotes.
Thanks!
git config --global core.editor "/Applications/Sublime\ Text.app/Contents/MacOS/Sublime\ Text"
works for me, thanks mate!!
^ I've found this to be the most durable option (on MacOS).
Step one
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
Step two
git config --global core.editor "subl -n -w"
Now you should be able to use Sublime text for git stuff like editing commit messages for reverts/squashes/etc.
Thank you! That works.
Works for me as well. Thank you @Alberto-GS!
git config --global core.editor "/Applications/Sublime\ Text.app/Contents/MacOS/Sublime\ Text"
Great !!!
For Sublime Text 3 this is a correct path git config --global core.editor "/Applications/Sublime\ Text.app/Contents/MacOS/sublime_text"
This worked for me on mac:
git config --global core.editor "open -a 'Sublime Text' --wait"
!
Option with git config --global core.editor "subl -n -w"
didnt work, resulted in error:
$ git commit
hint: Waiting for your editor to close the file... Failed to receive exit code from application
error: There was a problem with the editor 'subl -n -w'.
Please supply the message using either -m or -F option.
I'm on Sublime Text build no 4126 (up to date as of now) on mac and the executable name seems to have changed to sublime_text (rather than Sublime Text). You can check yours by going to the applications folder and right click, show package contents. The upshot is the following worked for me:
git config --global core.editor "/Applications/Sublime\ Text.app/Contents/MacOS/sublime_text"
prior solutions didn't work, so here's what worked for me—
OS: macOS 14.4 23E214 arm64
Shell: zsh 5.9
CPU: Apple M2
Editor: Sublime Text 4 (Build 4169)
check out Table 4 in section git config core.editor commands for an exhaustive list of core.editor
configuration commands (Pro Git 2nd Ed. Appendix C). looks helpful for other system / editor combinations, too.
solution in my case:
$ git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl --new-window --wait"
(source link and git blame in the book)
specifying the path to the macOS executable sublime_text
as @kitmw mentioned (thank you for the quick name check how-to) did not behave as expected:
2024-03-22 21:44:48.432 sublime_text[45060:2846253] WARNING: -restoreStateWithCoder: called with an
unsupported NSCoder.
It works on my mac. Thank you @xsqf !
macOS 13.5 Shell: zsh 5.9 CPU: Apple M2 Editor: Sublime Test 4
$ git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl --new-window --wait"
I've sent hours trying to figure this out and nothing from the list above is working. I keep on getting this message, yet I am able to launch sublime with just subl alias, but when I try to commit or merge this message pops up. I am confused, does my alias even work or not?
hint: Waiting for your editor to close the file... subl -n -w: subl: command not found
error: There was a problem with the editor 'subl -n -w'.
Please supply the message using either -m or -F option.