[ACCEPTED]-Trouble on setting the git 'core.editor'-osx-snow-leopard
The easiest way is to change the environment 13 variable EDITOR to point to mate. In your 12 .bash_profile
add the following:
export EDITOR="/usr/local/bin/mate -w"
and re-start your terminal 11 session, or source the .bash_profile
.
As for your error 10 message:
error: More than one value for the key core.editor: mate
it means you've added multiple core.editor 9 lines in your .gitconfig.
Use mate ~/.gitconfig
to modify 8 your .gitconfig
and remove the extra lines, or if 7 you don't mind unsetting all of them use:
git config --global --unset-all core.editor
Then 6 use
git config --global --add core.editor "/usr/local/bin/mate -w"
then you can leave $EDITOR
set to what it was 5 previously set to.
If mate
is not located in 4 /usr/local/bin
find where it is first by using type mate
(in bash, not 3 sure about other shells)
Since you want to 2 use open
as your $GIT_EDITOR
you will need the following:
-W Causes open to wait until the applications it opens (or that were already open) have exited. Use with the -n flag to allow open to function as an appropriate app for the $EDITOR environment variable.
-n Open a new instance of the application(s) even if one is already running.
This 1 will work for that:
git config --global --unset-all core.editor
git config --global --add core.editor "open -W -n"
The following works for me:
git config --global core.editor "open -a 'Sublime Text 2' -nW"
Using Mac OSX 2 10.7.4 and Sublime Text 2 Build 2181
Note:
I 1 have subl as an alias:
alias subl="/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl"
For what it's worth, here's how I solved 10 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 9 to /usr/local/bin/
pointing to Sublime Text 3 app’s binary 8 file. Now running subl
in Terminal will launch 7 Sublime Text 3 app.
2) Run in Terminal:
git config --global core.editor "subl -n -w"
This 6 adds editor = subl -n -w
to the [core]
section of the ~/.gitconfig
file. Now 5 running git commit
in Terminal will launch Sublime 4 Text 3 app (subl
) in a new window (-n
), and the 3 command line will wait (-w
) until the commit 2 message is saved.
Official Sublime Text 1 3 doc: http://www.sublimetext.com/docs/3/osx_command_line.html
To get this working for win7, open the .gitconfig 4 file in c:/users/username/ folder and add 3 the following line with --wait option outside 2 the double quotes.
[core]
editor = 'F:/Program Files/Sublime Text 2/sublime_text.exe' --wait
Hope its helpful to win7 1 users
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.