I have a problem setting Sublime Text 2 as the core.editor
with git
.
I've read through every post I could find addressing the problem, but still nothing is working for me. I am running Windows.
I have done:
git config --global core.editor "'C:/Program Files/Sublime Text 2/sublime_text.exe'"
and tried that with various arguments like -m
. When I open my .gitconfig
, this is what is in there:
[user]
name = Spencer Moran
email = smoran02@gmail.com
[core]
editor = 'C:/Program Files/Sublime Text 2/sublime_text.exe'
If I go to Git and type:
README.markdown --edit
the README file opens in Notepad, not Sublime Text.
Does anyone have any idea what I'm doing wrong or how I could fix this?
I was just struggling with this for some reason, none of the examples above quite worked for me. This was my solution however:
You specifically need the
' '
around the path and the$*
at the end of the args, all in" "
.With Sublime Text 2 and the following configuration, if nothing happens when you close the git commit's comment file :
If the git commit doesn't finish when you close the COMMIT_EDITMSG comment file in Sublime, I've found this is probably because you are running CMD in administrator mode (and have a Sublime Text already opened in non admin mode). I had the same problem and it worked for me when I started my CMD in normal mode.
Ps : just wanted to answer to the problem @david pointed out in the accepted answer's comments, but I couldn't post comment since I'm new here... so I've made a new answer, because I think this can be useful to some people encountering the problem.
For Mac OS X in the file ~/.gitconfig under [core] I had to put this code to solve the issue on my end.
This was when subl was working fine but git was unable to access it. And was displaying these errors
Windows
Sublime Text 2 (Build 2181)
The latest Build 2181 just added support for the
-w
(wait) command line argument. The following configuration will allow ST2 to work as your default git editor on Windows. This will allow git to open ST2 for commit messages and such.Sublime Text 3 (Build 3065)
Sublime Text 3 (Build 3065) added the
subl.exe
command line helper. Usesubl.exe -h
for the options available to you. I havehot_exit: true
andremember_open_files: true
set in my Sublime Text user settings. I have found the following to git config to work well for me.Mac and Linux
Set Sublime as your editor for Git by typing the following command in the terminal:
git config --global core.editor "subl -n -w"
With this Git config, the new tab is opened in my editor. I edit my commit message, save the tab (Ctrl+S) and close it (Ctrl+W).
Git will wait until the tab is closed to continue its work.
what worked for me in cygwin/zsh:
in /usr/local/bin create subl_git file
in gitconfig:
If you are Mac User, then here is how: