<p>I'm trying out <strong>Git on Windows</strong>. I got to the point of trying "git commit" and I got this error:</p>

<blockquote>
  <p>Terminal is dumb but no VISUAL nor
  EDITOR defined. Please supply the
  message using either -m or -F option.</p>
</blockquote>

<p>So I figured out I need to have an environment variable called EDITOR. No problem. I set it to point to Notepad. That worked, almost. The default commit message opens in Notepad. But Notepad doesn't support bare line feeds. I went out and got <a href="http://notepad-plus.sourceforge.net/uk/site.htm" rel="noreferrer">Notepad++</a>, but I can't figure out how to get Notepad++ set up as the <code>%EDITOR%</code> in such a way that it works with Git as expected.</p>

<p>I'm not married to Notepad++. At this point I don't mind what editor I use. I just want to be able to <strong>type commit messages in an editor</strong> rather than the command line (with <code>-m</code>).</p>

<p>Those of you using Git on Windows: What tool do you use to edit your commit messages, and what did you have to do to make it work?</p>

[{'answer_id': 10574, 'author': 'J Wynia', 'author_id': 1124, 'author_profile': 'https://Stackoverflow.com/users/1124', 'pm_score': 1, 'selected': False, 'text': '<p>I\'ve had difficulty getting Git to cooperate with <a href="http://en.wikipedia.org/wiki/WordPad" rel="nofollow noreferrer">WordPad</a>, <a href="https://en.wikipedia.org/wiki/Komodo_Edit" rel="nofollow noreferrer">Komodo Edit</a> and pretty much every other editor I give it. Most open for editing, but Git clearly doesn\'t wait for the save/close to happen. </p>\n\n<p>As a crutch, I\'ve just been doing i.e.</p>\n\n<pre><code>git commit -m "Fixed the LoadAll method"\n</code></pre>\n\n<p>to keep things moving. It tends to keep my commit messages a little shorter than they probably should be, but clearly there\'s some work to be done on the Windows version of Git.</p>\n\n<p>The GitGUI also isn\'t that bad. It takes a little bit of orientation, but after that, it works fairly well.</p>\n'}, {'answer_id': 10625, 'author': 'Patrick Johnmeyer', 'author_id': 363, 'author_profile': 'https://Stackoverflow.com/users/363', 'pm_score': 4, 'selected': False, 'text': '<p>Notepad++ works just fine, although I choose to stick with Notepad, -m, or even sometimes the built-in "edit."</p>\n\n<p>The problem you are encountering using Notepad++ is related to how Git is launching the editor executable.  My solution to this is to set environment variable <code>EDITOR</code> to a batch file, rather than the actual editor executable, that does the following:</p>\n\n<pre><code>start /WAIT "E:\\PortableApps\\Notepad++Portable\\Notepad++Portable.exe" %*\n</code></pre>\n\n<p><code>/WAIT</code> tells the command line session to halt until the application exits, thus you will be able to edit to your heart\'s content while Git happily waits for you.  %* passes all arguments to the batch file through to Notepad++.</p>\n\n<pre><code>C:\\src&gt; echo %EDITOR%\nC:\\tools\\runeditor.bat\n</code></pre>\n'}, {'answer_id': 11129, 'author': 'Matt McMinn', 'author_id': 1322, 'author_profile': 'https://Stackoverflow.com/users/1322', 'pm_score': 3, 'selected': False, 'text': '<p><a href="http://www.vim.org/" rel="nofollow noreferrer">Vim/gVim</a> works well for me.</p>\n\n<pre><code>&gt;echo %EDITOR%\n\nc:\\Vim\\Vim71\\vim.exe\n</code></pre>\n'}, {'answer_id': 640142, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p>It seems as if Git won\'t find the editor if there are spaces in the path. So you will have to put the batch file mentioned in <a href="https://stackoverflow.com/questions/10564/how-can-i-set-up-an-editor-to-work-with-git-on-windows/10625#10625">Patrick\'s answer</a> into a non-whitespace path.</p>\n'}, {'answer_id': 773973, 'author': 'VonC', 'author_id': 6309, 'author_profile': 'https://Stackoverflow.com/users/6309', 'pm_score': 10, 'selected': True, 'text': '<p>Update September 2015 (6 years later)</p>\n\n<p>The <a href="https://github.com/git-for-windows/git/releases/tag/v2.5.3.windows.1" rel="noreferrer">last release of git-for-Windows (2.5.3)</a> now includes:</p>\n\n<blockquote>\n  <p>By configuring <strong><code>git config core.editor notepad</code></strong>, users <a href="https://github.com/git-for-windows/git/issues/381" rel="noreferrer">can now use <code>notepad.exe</code> as their default editor</a>.<br>\n  Configuring <code>git config format.commitMessageColumns 72</code> will be picked up by the notepad wrapper and line-wrap the commit message after the user edits it.</p>\n</blockquote>\n\n<p>See <a href="https://github.com/git-for-windows/build-extra/commit/69b301bbd7c18226c63d83638991cb2b7f84fb64" rel="noreferrer">commit 69b301b</a> by <a href="https://github.com/dscho" rel="noreferrer">Johannes Schindelin (<code>dscho</code>)</a>.</p>\n\n<p>And Git 2.16 (Q1 2018) will show a message to tell the user that it is waiting for the user to finish editing when spawning an editor, in case the editor\nopens to a hidden window or somewhere obscure and the user gets\nlost.</p>\n\n<p>See <a href="https://github.com/git/git/commit/abfb04d0c74cde804c734015ff5868a88c84fb6f" rel="noreferrer">commit abfb04d</a> (07 Dec 2017), and <a href="https://github.com/git/git/commit/a64f213d3fa13fa01e582b6734fe7883ed975dc9" rel="noreferrer">commit a64f213</a> (29 Nov 2017) by <a href="https://github.com/larsxschneider" rel="noreferrer">Lars Schneider (<code>larsxschneider</code>)</a>.<br>\nHelped-by: <a href="https://github.com/gitster" rel="noreferrer">Junio C Hamano (<code>gitster</code>)</a>.<br>\n<sup>(Merged by <a href="https://github.com/gitster" rel="noreferrer">Junio C Hamano -- <code>gitster</code> --</a> in <a href="https://github.com/git/git/commit/0c69a132cb1adf0ce9f31e6631f89321e437cb76" rel="noreferrer">commit 0c69a13</a>, 19 Dec 2017)</sup></p>\n\n<blockquote>\n  <h2><code>launch_editor()</code>: indicate that Git waits for user input</h2>\n  \n  <p>When a graphical <code>GIT_EDITOR</code> is spawned by a Git command that opens\n  and waits for user input (e.g. "<code>git rebase -i</code>"), then the editor window\n  might be obscured by other windows.<br>\n  The user might be left staring at\n  the original Git terminal window without even realizing that s/he needs\n  to interact with another window before Git can proceed. To this user Git\n  appears hanging.</p>\n  \n  <p>Print a message that Git is waiting for editor input in the original\n  terminal and get rid of it when the editor returns, if the terminal\n  supports erasing the last line</p>\n</blockquote>\n\n<hr>\n\n<p>Original answer</p>\n\n<p>I just tested it with git version 1.6.2.msysgit.0.186.gf7512 and Notepad++5.3.1</p>\n\n<p>I prefer to <em>not</em> have to set an EDITOR variable, so I tried:</p>\n\n<pre class="lang-bash prettyprint-override"><code>git config --global core.editor "\\"c:\\Program Files\\Notepad++\\notepad++.exe\\""\n# or\ngit config --global core.editor "\\"c:\\Program Files\\Notepad++\\notepad++.exe\\" %*"\n</code></pre>\n\n<p>That always gives:</p>\n\n<pre><code>C:\\prog\\git&gt;git config --global --edit\n"c:\\Program Files\\Notepad++\\notepad++.exe" %*: c:\\Program Files\\Notepad++\\notepad++.exe: command not found\nerror: There was a problem with the editor \'"c:\\Program Files\\Notepad++\\notepad++.exe" %*\'.\n</code></pre>\n\n<p>If I define a npp.bat including:</p>\n\n<pre><code>"c:\\Program Files\\Notepad++\\notepad++.exe" %*\n</code></pre>\n\n<p>and I type:</p>\n\n<pre><code>C:\\prog\\git&gt;git config --global core.editor C:\\prog\\git\\npp.bat\n</code></pre>\n\n<p>It just works from the DOS session, <strong>but not from the git shell</strong>.<br>\n(not that with the core.editor configuration mechanism, a script with "<code>start /WAIT...</code>" in it would not work, but only open a new DOS window)</p>\n\n<hr>\n\n<p><a href="https://stackoverflow.com/questions/10564/how-can-i-set-up-an-editor-to-work-with-git-on-windows/1431003#1431003">Bennett\'s answer</a> mentions the possibility to avoid adding a script, but to reference directly the program itself <strong>between simple quotes</strong>. Note the direction of the slashes! Use <code>/</code> NOT <code>\\</code> to separate folders in the path name!</p>\n\n<pre class="lang-bash prettyprint-override"><code>git config --global core.editor \\\n"\'C:/Program Files/Notepad++/notepad++.exe\' -multiInst -notabbar -nosession -noPlugin"\n</code></pre>\n\n<p>Or if you are in a 64 bit system:</p>\n\n<pre class="lang-bash prettyprint-override"><code>git config --global core.editor \\\n"\'C:/Program Files (x86)/Notepad++/notepad++.exe\' -multiInst -notabbar -nosession -noPlugin"\n</code></pre>\n\n<p>But I prefer using a script (see below): that way I can play with different paths or different options without having to register again a <code>git config</code>.</p>\n\n<hr>\n\n<p>The actual solution (with a script) was to realize that:<br>\n<strong>what you refer to in the config file is actually a shell (<code>/bin/sh</code>) script</strong>, not a DOS script.</p>\n\n<p>So what does work is:</p>\n\n<pre><code>C:\\prog\\git&gt;git config --global core.editor C:/prog/git/npp.bat\n</code></pre>\n\n<p>with <code>C:/prog/git/npp.bat</code>:</p>\n\n<pre class="lang-bash prettyprint-override"><code>#!/bin/sh\n"c:/Program Files/Notepad++/notepad++.exe" -multiInst "$*"\n</code></pre>\n\n<p>or</p>\n\n<pre class="lang-bash prettyprint-override"><code>#!/bin/sh\n"c:/Program Files/Notepad++/notepad++.exe" -multiInst -notabbar -nosession -noPlugin "$*"\n</code></pre>\n\n<p>With that setting, I can do \'<code>git config --global --edit</code>\' from DOS or Git Shell, or I can do \'<code>git rebase -i ...</code>\' from DOS or Git Shell.<br>\nBot commands will trigger a new instance of notepad++ (hence the <code>-multiInst</code>\' option), and wait for that instance to be closed before going on.</p>\n\n<p>Note that I use only \'/\', not <code>\\</code>\'. And I <a href="https://stackoverflow.com/questions/623518/msysgit-on-windows-what-should-i-be-aware-of-if-any">installed msysgit using option 2.</a> (Add the <code>git\\bin</code> directory to the <code>PATH</code> environment variable, but without overriding some built-in windows tools)</p>\n\n<p>The fact that the notepad++ wrapper is called .bat is not important.<br>\nIt would be better to name it \'npp.sh\' and to put it in the <code>[git]\\cmd</code> directory though (or in any directory referenced by your PATH environment variable).</p>\n\n<hr>\n\n<p>See also:</p>\n\n<ul>\n<li><a href="https://stackoverflow.com/questions/255202/how-do-i-view-git-diff-output-with-visual-diff-program/255212#255212">How do I view ‘git diff’ output with visual diff program?</a> for the general theory</li>\n<li><a href="https://stackoverflow.com/questions/780425/how-do-i-setup-diffmerge-with-msysgit-gitk/783667#783667">How do I setup DiffMerge with msysgit / gitk?</a> for another example of external tool (DiffMerge, and WinMerge)</li>\n</ul>\n\n<hr>\n\n<p><a href="https://stackoverflow.com/users/2716305/lightfire228">lightfire228</a> adds <a href="https://stackoverflow.com/questions/10564/how-can-i-set-up-an-editor-to-work-with-git-on-windows/773973#comment74027740_773973">in the comments</a>:</p>\n\n<blockquote>\n  <p>For anyone having an issue where N++ just opens a blank file, and git doesn\'t take your commit message, see "<a href="https://stackoverflow.com/q/30085970/6309">Aborting commit due to empty message</a>": change your <code>.bat</code> or <code>.sh</code> file to say:</p>\n</blockquote>\n\n<pre><code>"&lt;path-to-n++" .git/COMMIT_EDITMSG -&lt;arguments&gt;. \n</code></pre>\n\n<blockquote>\n  <p>That will tell notepad++ to open the temp commit file, rather than a blank new one.</p>\n</blockquote>\n'}, {'answer_id': 1083830, 'author': 'Darren Bishop', 'author_id': 133330, 'author_profile': 'https://Stackoverflow.com/users/133330', 'pm_score': 6, 'selected': False, 'text': '<p>Anyway, I\'ve just been playing around with this and found the following to work nicely for me:</p>\n\n<pre><code>git config --global core.editor "\'C:/Program Files/TextPad 5/TextPad.exe\' -m"\n</code></pre>\n\n<p>I don\'t think CMD likes single-quotes so you must use double quotes "to specify the space embedded string argument".</p>\n\n<p>Cygwin (which I believe is the underlying platform for Git\'s Bash) on the other hand likes both <code>\'</code> and <code>"</code>; you can specify a CMD-like paths, using <code>/</code> instead of <code>\\</code>, so long as the string is quoted i.e. in this instance, using single-quotes.</p>\n\n<p>The <code>-m</code> overrides/indicates the use of multiple editors and there is no need for a <code>%*</code> tacked on the end.</p>\n'}, {'answer_id': 1086587, 'author': 'bjnortier', 'author_id': 35448, 'author_profile': 'https://Stackoverflow.com/users/35448', 'pm_score': 2, 'selected': False, 'text': '<p>I use <a href="http://en.wikipedia.org/wiki/Cygwin" rel="nofollow noreferrer">Cygwin</a> on Windows, so I use:</p>\n\n<pre><code>export EDITOR="emacs -nw"\n</code></pre>\n\n<p>The <code>-nw</code> is for <code>no-windows</code>, i.e. tell Emacs not to try and use <a href="http://en.wikipedia.org/wiki/X_Window_System" rel="nofollow noreferrer">X Window</a>.</p>\n\n<p>The Emacs keybindings don\'t work for me from a Windows shell, so I would only use this from a Cygwin shell... (<a href="https://en.wikipedia.org/wiki/Rxvt" rel="nofollow noreferrer">rxvt</a> is recommended.)</p>\n'}, {'answer_id': 1380109, 'author': 'Tom Dunham', 'author_id': 6402, 'author_profile': 'https://Stackoverflow.com/users/6402', 'pm_score': 1, 'selected': False, 'text': '<p>I\'ve just had the same problem and found a different solution. I was getting </p>\n\n<pre><code>error: There was a problem with the editor \'ec\'\n</code></pre>\n\n<p>I\'ve got <code>VISUAL=ec</code>, and a batch file called <code>ec.bat</code> on my path that contains one line:</p>\n\n<pre><code>c:\\emacs\\emacs-23.1\\bin\\emacsclient.exe %*\n</code></pre>\n\n<p>This lets me edit files from the command line with <code>ec &lt;filename&gt;</code>, and having <code>VISUAL</code> set means most unixy programs pick it up too. Git seems to search the path differently to my other commands though -  when I looked at a <code>git commit</code> in <a href="http://en.wikipedia.org/wiki/Process_Monitor" rel="nofollow noreferrer">Process Monitor</a> I saw it look in every folder on the path for <code>ec</code> and for <code>ec.exe</code>, but not for <code>ec.bat</code>. I added another environment variable (<code>GIT_EDITOR=ec.bat</code>) and all was fine.</p>\n'}, {'answer_id': 1431003, 'author': 'Bennett McElwee', 'author_id': 61754, 'author_profile': 'https://Stackoverflow.com/users/61754', 'pm_score': 8, 'selected': False, 'text': '<p>Building on <a href="https://stackoverflow.com/questions/10564/how-can-i-set-up-an-editor-to-work-with-git-on-windows/1083830#1083830">Darren\'s answer</a>, to use Notepad++ you can simply do this (all on one line):</p>\n<pre><code>git config --global core.editor &quot;\'C:/Program Files/Notepad++/notepad++.exe\' -multiInst -notabbar -nosession -noPlugin&quot;\n</code></pre>\n<p>Obviously, the <code>C:/Program Files/Notepad++/notepad++.exe</code> part should be the path to the Notepad++ executable on your system. For example, it might be <code>C:/Program Files (x86)/Notepad++/notepad++.exe</code>.</p>\n<p>It works like a charm for me.</p>\n<p>Article <a href="https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/How-to-set-Notepad-as-the-default-Git-editor-for-commits-instead-of-Vim" rel="noreferrer">How to set Notepad++ as the default Git editor for commits instead of Vim</a> explains parameters of the command.</p>\n'}, {'answer_id': 1574521, 'author': 'Tim Henigan', 'author_id': 63147, 'author_profile': 'https://Stackoverflow.com/users/63147', 'pm_score': 3, 'selected': False, 'text': '<p>I also use Cygwin on Windows, but with gVim (as opposed to the terminal-based <a href="http://en.wikipedia.org/wiki/Vim_%28text_editor%29" rel="nofollow noreferrer">Vim</a>).</p>\n\n<p>To make this work, I have done the following:</p>\n\n<ol>\n<li>Created a one-line batch file (named <code>git_editor.bat</code>) which contains the following:\n<code>"C:/Program Files/Vim/vim72/gvim.exe" --nofork "%*"</code></li>\n<li>Placed <code>git_editor.bat</code> on in my <code>PATH</code>.</li>\n<li>Set <code>GIT_EDITOR=git_editor.bat</code></li>\n</ol>\n\n<p>With this done, <code>git commit</code>, etc. will correctly invoke the gVim executable.</p>\n\n<p>NOTE 1: The <code>--nofork</code> option to gVim ensures that it blocks until the commit message has been written.</p>\n\n<p>NOTE 2: The quotes around the path to gVim is required if you have spaces in the path.</p>\n\n<p>NOTE 3: The quotes around "%*" are needed just in case Git passes a file path with spaces.</p>\n'}, {'answer_id': 2583824, 'author': 'Whome', 'author_id': 185565, 'author_profile': 'https://Stackoverflow.com/users/185565', 'pm_score': 3, 'selected': False, 'text': '<p>I had PortableGit 1.6 working fine, but after upgrading to the PortableGit 1.7 Windows release, I had problems. Some of the Git commands opens up the Notepad++.exe fine, but some don\'t, especially <em>Git rebase</em> behaves differently.</p>\n\n<p>The problem is some commands run the Windows cmd process and some use the Unix cmd process. I want to give startup attributes to Notepad++ editor, so I need to have a customized script. My solution is this.</p>\n\n<ol>\n<li><p>Create a script to run an appropriate text editor. The script looks weird, but it handles both the Windows and Unix variation.</p>\n\n<p><strong>c:/PortableGit/cmd/git-editor.bat</strong></p>\n\n<pre><code>#!/bin/sh\n# Open a new instance\n\nfunction doUnix() {\n  "c:\\program files\\notepad++\\notepad++.exe" -multiInst -nosession -notabbar $*\n  exit\n}\n\ndoUnix $*\n\n:WINCALL\n"c:\\program files\\notepad++\\notepad++.exe" -multiInst -nosession -notabbar %*\n</code></pre></li>\n<li><p>Set the global core.editor variable</p>\n\n<p>The script was saved to git/cmd folder, so it\'s already in a gitconsole path. This is mandatory as a full path may not work properly.</p>\n\n<pre><code>git config --global core.editor "git-editor.bat"\n</code></pre></li>\n</ol>\n\n<p>Now I can run the <em>git commit -a</em> and <em>git rebase -i master</em> commands. Give it a try if you have problems in the Git Windows tool.</p>\n'}, {'answer_id': 3319715, 'author': 'Michael Steele', 'author_id': 71116, 'author_profile': 'https://Stackoverflow.com/users/71116', 'pm_score': 2, 'selected': False, 'text': '<p>I prefer to use Emacs. Getting it set up can be a little tricky.</p>\n\n<ol>\n<li>Download Emacs and unpack it somewhere like <code>c:\\emacs</code>.</li>\n<li>Run <code>c:\\emacs\\bin\\addpm.exe</code>. You need to right-click and "Run as Administrator" if you are using Windows Vista or above. This will put the executables in your path.</li>\n<li>Add <code>(server-start)</code> somewhere in your <code>.emacs</code> file. See the <a href="http://www.gnu.org/software/emacs/windows/Installing-Emacs.html#Installing-Emacs" rel="nofollow noreferrer">Emacs Windows FAQ</a> for advice on where to put your <code>.emacs</code> file.</li>\n<li><code>git config --global core.editor emacsclientw</code></li>\n</ol>\n\n<p>Git will now open files within an existing Emacs process. You will have to run that existing process manually from <code>c:\\emacs\\bin\\runemacs.exe</code>.</p>\n'}, {'answer_id': 3422569, 'author': 'Gavin', 'author_id': 78216, 'author_profile': 'https://Stackoverflow.com/users/78216', 'pm_score': 4, 'selected': False, 'text': '<p><strong><a href="http://en.wikipedia.org/wiki/WordPad" rel="nofollow noreferrer">WordPad</a>!</strong></p>\n\n<p>I\'m happy using Vim, but since I\'m trying to introduce Git to the company I wanted something that we\'d all have, and found that WordPad seems to work okay (i.e. Git does wait until you\'re finished editing and close the window).</p>\n\n<pre><code>git config core.editor \'"C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe"\'\n</code></pre>\n\n<p>That\'s using Git Bash on msysgit; I\'ve not tried from the Windows command prompt (if that makes any difference).</p>\n'}, {'answer_id': 3820077, 'author': 'CharlesB', 'author_id': 11343, 'author_profile': 'https://Stackoverflow.com/users/11343', 'pm_score': 2, 'selected': False, 'text': '<p>This is my setup to use <a href="http://www.geany.org/" rel="nofollow noreferrer">Geany</a> as an editor for Git:</p>\n\n<pre><code>git config --global core.editor C:/path/to/geany.bat\n</code></pre>\n\n<p>with the following content in <code>geany.bat</code>:</p>\n\n<pre><code>#!/bin/sh\n"C:\\Program Files\\Geany\\bin\\Geany.exe" --new-instance "$*"\n</code></pre>\n\n<p>It works in both a DOS console and msysgit.</p>\n'}, {'answer_id': 4652019, 'author': 'Nick Knowlson', 'author_id': 224354, 'author_profile': 'https://Stackoverflow.com/users/224354', 'pm_score': 5, 'selected': False, 'text': '<p><strong>Edit:</strong> After updating to Vim 7.3, I\'ve come to the conclusion that the cleanest and easiest way to do this is:</p>\n\n<ol>\n<li><p>Add Vim\'s main folder to your path (right click on <em>My Computer</em> &rarr; <em>Properties</em> &rarr; <em>Advanced</em> &rarr; <em>Environment Variables</em>)</p></li>\n<li><p>Run this:</p>\n\n<pre><code>git config --global core.editor "gvim --nofork \'%*\'"\n</code></pre></li>\n</ol>\n\n<p>If you do it this way, then I am fairly sure it will work with Cygwin as well.</p>\n\n<p><strong>Original answer:</strong></p>\n\n<p>Even with a couple of Vim-related answers, I was having trouble getting this to work with gVim under Windows (while not using a batch file or %EDITOR% or Cygwin).</p>\n\n<p>What I eventually arrived at is nice and clean, and draws from a few of the solutions here:</p>\n\n<pre class="lang-bash prettyprint-override"><code>git config --global core.editor \\\n"\'C:/Program Files/Vim/vim72/gvim.exe\' --nofork \'%*\'"\n</code></pre>\n\n<p>One gotcha that took me a while is these are not the Windows-style backslashes. They are normal forward slashes.</p>\n'}, {'answer_id': 4792999, 'author': 'Mike', 'author_id': 419934, 'author_profile': 'https://Stackoverflow.com/users/419934', 'pm_score': 1, 'selected': False, 'text': '<p>I managed to get the environment version working by setting the EDITOR variable using quotes and <code>/</code>:</p>\n\n<pre><code>EDITOR="c:/Program Files (x86)/Notepad++/notepad++.exe"\n</code></pre>\n'}, {'answer_id': 6626128, 'author': 'lambacck', 'author_id': 108518, 'author_profile': 'https://Stackoverflow.com/users/108518', 'pm_score': 3, 'selected': False, 'text': '<p>This is the one symptom of greater issues. Notably that you have something setting <code>TERM=dumb</code>. Other things that don\'t work properly are the <code>less</code> command which says you don\'t have a fully functional terminal.</p>\n\n<p>It seems like this is most commonly caused by having TERM set to something in your global Windows environment variables. For me, the issue came up when I installed <a href="http://en.wikipedia.org/wiki/Strawberry_Perl" rel="nofollow noreferrer">Strawberry Perl</a> some information about this is on the <a href="http://code.google.com/p/msysgit/issues/detail?id=184#c42" rel="nofollow noreferrer">msysgit bug for this problem</a> as well as several solutions.</p>\n\n<p>The first solution is to fix it in your ~/.bashrc by adding:</p>\n\n<pre><code>export TERM=msys\n</code></pre>\n\n<p>You can do this from the Git Bash prompt like so:</p>\n\n<pre><code>echo "export TERM=msys" &gt;&gt; ~/.bashrc\n</code></pre>\n\n<p>The other solution, which ultimately is what I did because I don\'t care about Strawberry Perl\'s reasons for adding <code>TERM=dumb</code> to my environment settings, is to go and remove the <code>TERM=dumb</code> as <a href="http://code.google.com/p/msysgit/issues/detail?id=184#c40" rel="nofollow noreferrer">directed in this comment on the msysgit bug report</a>.</p>\n\n<blockquote>\n  <p>Control\n  Panel/System/Advanced/Environment\n  Variables... (or similar, depending on\n  your  version of Windows) is where\n  sticky environment variables are set\n  on Windows. By  default, TERM is not\n  set. If TERM is set in there, then you\n  (or one of the programs  you have\n  installed - e.g. Strawberry Perl) has\n  set it. Delete that setting, and you\n  should be fine.</p>\n</blockquote>\n\n<p>Similarly if you use Strawberry Perl and care about the <a href="http://en.wikipedia.org/wiki/CPAN" rel="nofollow noreferrer">CPAN</a> client or something like that, you can leave the <code>TERM=dumb</code> alone and use <code>unset TERM</code> in your ~/.bashrc file which will have a similar effect to setting an explicit term as above.</p>\n\n<p>Of course, all the other solutions are correct in that you can use <code>git config --global core.editor $MYFAVORITEEDITOR</code> to make sure that Git uses your favorite editor when it needs to launch one for you.</p>\n'}, {'answer_id': 7163913, 'author': 'mbx', 'author_id': 303290, 'author_profile': 'https://Stackoverflow.com/users/303290', 'pm_score': 0, 'selected': False, 'text': '<p>When using a remotely mounted homedrive (<a href="http://en.wikipedia.org/wiki/Samba_%28software%29" rel="nofollow noreferrer">Samba</a> share, NFS, ...) your <code>~/.git</code> folder is shared across all systems which can lead to several problems. Thus I prefer a script to determine the right editor for the right system:</p>\n\n<pre><code>#!/usr/bin/perl\n# Detect which system I\'m on and choose the right editor\n$unamea = `uname -a`;\nif($unamea =~ /mingw/i){\n    if($unamea =~ /devsystem/i){#Check hostname\n        exec(\'C:\\Program Files (x86)\\Notepad++\\notepad++.exe\', \'-multiInst\', \'-nosession\', @ARGV);\n    }\n    if($unamea =~ /testsystem/i){\n        exec(\'C:\\Program Files\\Notepad++\\notepad++.exe\', \'-multiInst\', \'-nosession\', @ARGV);\n    }\n}\n$MCEDIT=`which mcedit`;\nif($MCEDIT =~ /mcedit/){\n    exec($MCEDIT, @ARGV);\n}\n$NANO=`which nano`;\nif($NANO =~ /nano/){\n    exec($NANO, @ARGV);\n}\ndie "You don\'t have a suitable editor!\\n";\n</code></pre>\n\n<p>One might consider a plain shell script, but I used Perl as it is shipped with msysgit and your <a href="https://en.wikipedia.org/wiki/Unix-like" rel="nofollow noreferrer">Unix-like</a> systems will usually provide one as well.\nPutting the script in <code>/home/username/bin</code>, which should be added to <code>PATH</code> in <code>.bashrc</code> or <code>.profile</code>. Once added with <code>git config --global core.editor giteditor.pl</code> you have the right editor, wherever you are.</p>\n'}, {'answer_id': 7549705, 'author': 'Edward J Beckett', 'author_id': 538921, 'author_profile': 'https://Stackoverflow.com/users/538921', 'pm_score': 3, 'selected': False, 'text': '<p>Thanks to the Stack&nbsp;Overflow community ... and a little research I was able to get my favorite editor,  <a href="http://www.editpadpro.com" rel="nofollow noreferrer"><strong>EditPad Pro</strong></a>, to work as the core editor with msysgit 1.7.5.GIT and TortoiseGit v1.7.3.0 over Windows&nbsp;XP SP3...</p>\n\n<p>Following the advice above, I added the path to a Bash script for the code editor...</p>\n\n<pre><code>git config --global core.editor c:/msysgit/cmd/epp.sh\n</code></pre>\n\n<p>However, after several failed attempts at the above mentioned solutions ... I was finally able to get this working. Per EditPad Pro\'s documentation, adding the \'/newinstance\' flag would allow the shell to wait for the editor input...</p>\n\n<p>The \'<strong>/newinstance</strong>\' flag was the key in my case...</p>\n\n<pre><code>#!/bin/sh\n"C:/Program Files/JGsoft/EditPadPro6/EditPadPro.exe" //newinstance "$*"\n</code></pre>\n'}, {'answer_id': 10968585, 'author': 'icc97', 'author_id': 327074, 'author_profile': 'https://Stackoverflow.com/users/327074', 'pm_score': -1, 'selected': False, 'text': '<p>I just use <a href="http://en.wikipedia.org/wiki/TortoiseGit" rel="nofollow noreferrer">TortoiseGit</a> straight out the box. It integrates beautifully with my <a href="http://en.wikipedia.org/wiki/PuTTY" rel="nofollow noreferrer">PuTTY</a> public keys. </p>\n\n<p>It has a perfect editor for commit messages.</p>\n'}, {'answer_id': 12899808, 'author': 'kghastie', 'author_id': 1028062, 'author_profile': 'https://Stackoverflow.com/users/1028062', 'pm_score': 0, 'selected': False, 'text': '<p>This is working for me using Cygwin and <a href="http://en.wikipedia.org/wiki/TextPad" rel="nofollow noreferrer">TextPad</a> 6 (EDIT: it is also working with TextPad 5 as long as you make the obvious change to the script), and presumably the model could be used for other editors as well:</p>\n\n<p>File <code>~/.gitconfig</code>:</p>\n\n<pre><code>[core]\n    editor = ~/script/textpad.sh\n</code></pre>\n\n<p>File <code>~/script/textpad.sh</code>:</p>\n\n<pre><code>#!/bin/bash\n\nAPP_PATH=`cygpath "c:/program files (x86)/textpad 6/textpad.exe"`\nFILE_PATH=`cygpath -w $1`\n\n"$APP_PATH" -m "$FILE_PATH"\n</code></pre>\n\n<p>This one-liner works as well:</p>\n\n<p>File <code>~/script/textpad.sh</code> (option 2):</p>\n\n<pre><code>"`cygpath "c:/program files (x86)/textpad 6/textpad.exe"`" -m "`cygpath -w $1`"\n</code></pre>\n'}, {'answer_id': 17024500, 'author': 'Bill', 'author_id': 368316, 'author_profile': 'https://Stackoverflow.com/users/368316', 'pm_score': 3, 'selected': False, 'text': "<p>I use Git on multiple platforms, and I like to use the same Git settings on all of them. (In fact, I have all my configuration files under release control with Git, and put a Git repository clone on each machine.) The solution I came up with is this:</p>\n\n<p>I set my <strong>editor</strong> to <strong>giteditor</strong></p>\n\n<pre><code>git config --global core.editor giteditor\n</code></pre>\n\n<p>Then I create a symbolic link called <strong>giteditor</strong> which is in my <strong>PATH</strong>. (I have a personal <strong>bin</strong> directory, but anywhere in the <strong>PATH</strong> works.) That link points to my current editor of choice. On different machines and different platforms, I use different editors, so this means that I don't have to change my universal Git configuration (<strong>.gitconfig</strong>), just the link that <strong>giteditor</strong> points to.</p>\n\n<p>Symbolic links are handled by every operating system I know of, though they may use different commands. For Linux, you use <strong>ln -s</strong>. For Windows, you use the <strong>cmd</strong> built-in <strong>mklink</strong>. They have different syntaxes (which you should look up), but it all works the same way, really.</p>\n"}, {'answer_id': 21127799, 'author': 'javimsevilla', 'author_id': 3196339, 'author_profile': 'https://Stackoverflow.com/users/3196339', 'pm_score': 0, 'selected': False, 'text': '<p>This worked for me:</p>\n\n<ol>\n<li>Add the directory which contains the editor\'s executable to your <strong><em>PATH</em></strong> variable. (E.g. <em>"C:\\Program Files\\Sublime Text 3\\"</em>)</li>\n<li>Reboot your computer.</li>\n<li>Change the <em>core.editor</em> global Git variable to the name of the editor executable <strong>without the extension</strong> <em>\'.exe\'</em> (e.g. git config --global core.editor sublime_text)</li>\n</ol>\n\n<p>That\'s it!</p>\n\n<p><strong>NOTE:</strong> <a href="http://en.wikipedia.org/wiki/Sublime_Text" rel="nofollow noreferrer">Sublime Text</a> 3 is the editor I used for this example.</p>\n'}, {'answer_id': 28386190, 'author': 'JaKXz', 'author_id': 1444541, 'author_profile': 'https://Stackoverflow.com/users/1444541', 'pm_score': 1, 'selected': False, 'text': "<p>I'm using GitHub for Windows which is a nice visual option. But I also prefer the command line, so to make it work when I open a repository in a Git shell I just set the following:</p>\n\n<pre><code>git config --global core.editor vim\n</code></pre>\n\n<p>which works great.</p>\n"}, {'answer_id': 31757683, 'author': 'rofrol', 'author_id': 588759, 'author_profile': 'https://Stackoverflow.com/users/588759', 'pm_score': 1, 'selected': False, 'text': '<p>This works for PowerShell and <a href="https://cmder.net/" rel="nofollow noreferrer">cmder</a> 1.2 (when used with PowerShell). In file <code>~/.gitconfig</code>:</p>\n\n<pre><code>[core]\n    editor = \'c:/program files/sublime text 3/subl.exe\' -w\n</code></pre>\n\n<p><em><a href="https://stackoverflow.com/questions/8951275/how-can-i-make-sublime-text-the-default-editor-for-git/9408117#9408117">How can I make Sublime Text the default editor for Git?</a></em></p>\n'}, {'answer_id': 33368301, 'author': 'avg', 'author_id': 1295023, 'author_profile': 'https://Stackoverflow.com/users/1295023', 'pm_score': 1, 'selected': False, 'text': '<p>I found a a beautifully simple solution posted <a href="https://danlimerick.wordpress.com/2014/01/07/git-for-windows-tip-opening-sublime-text-from-bash/" rel="nofollow noreferrer" title="here">here</a> - although there may be a mistake in the path in which you have to copy over the "subl" file given by the author.</p>\n\n<p>I am running Windows&nbsp;7 x64, and I had to put the "subl" file in my <code>/Git/cmd/</code> folder to make it work. </p>\n\n<p>It works like a charm, though.</p>\n'}, {'answer_id': 37169060, 'author': 'Daniel', 'author_id': 3592441, 'author_profile': 'https://Stackoverflow.com/users/3592441', 'pm_score': 3, 'selected': False, 'text': '<p>Based on <a href="https://stackoverflow.com/users/6309/vonc">VonC\'s</a> <a href="https://stackoverflow.com/a/773973/6309">suggestion</a>, this worked for me (was driving me crazy):</p>\n\n<pre><code>git config --global core.editor "\'C:/Program Files (x86)/Sublime Text 3/subl.exe\' -wait"\n</code></pre>\n\n<p>Omitting <code>-wait</code> can cause problems, especially if you are working with <a href="https://en.wikipedia.org/wiki/Gerrit_(software)" rel="nofollow noreferrer">Gerrit</a> and change ids that have to be manually copied to the bottom of your commit message.</p>\n'}, {'answer_id': 37558341, 'author': 'Jonathan Ramos', 'author_id': 5934012, 'author_profile': 'https://Stackoverflow.com/users/5934012', 'pm_score': 1, 'selected': False, 'text': '<h2>Atom and Windows 10</h2>\n<ol>\n<li><p>I right clicked the Atom icon at the desktop and clicked on properties.</p>\n</li>\n<li><p>Copied the &quot;Start in&quot; location path</p>\n</li>\n<li><p>Looked over there with Windows\xa0Explorer and found &quot;atom.exe&quot;.</p>\n</li>\n<li><p>I typed this in Git Bash:</p>\n<pre><code>git config --global core.editor C:/Users/YOURNAMEUSER/AppData/Local/atom/app-1.7.4/atom.exe&quot;\n</code></pre>\n</li>\n</ol>\n<p>Note: I changed all <code>\\</code> for <code>/</code> . I created a .bashrc at my home directory and used <code>/</code> to set my home directory and it worked, so I assumed <code>/</code> will be the way to go.</p>\n<p><a href="/questions/tagged/atom-editor" class="post-tag" title="show questions tagged &#39;atom-editor&#39;" rel="tag">atom-editor</a> <a href="/questions/tagged/git" class="post-tag" title="show questions tagged &#39;git&#39;" rel="tag">git</a> <a href="/questions/tagged/git-bash" class="post-tag" title="show questions tagged &#39;git-bash&#39;" rel="tag">git-bash</a> <a href="/questions/tagged/windows-10" class="post-tag" title="show questions tagged &#39;windows-10&#39;" rel="tag">windows-10</a></p>\n'}, {'answer_id': 39900408, 'author': 'OmgKemuel', 'author_id': 4318447, 'author_profile': 'https://Stackoverflow.com/users/4318447', 'pm_score': 4, 'selected': False, 'text': '<p>For <strong><a href="https://en.wikipedia.org/wiki/Atom_(text_editor)" rel="noreferrer">Atom</a></strong> you can do</p>\n\n<pre><code>git config --global core.editor "atom --wait"\n</code></pre>\n\n<p>and similar for <strong><a href="https://en.wikipedia.org/wiki/Visual_Studio_Code" rel="noreferrer">Visual Studio Code</a></strong></p>\n\n<pre><code>git config --global core.editor "code --wait"\n</code></pre>\n\n<p>which will open up an <strong>Atom</strong> or <strong>Visual Studio Code</strong> window for you to commit through, </p>\n\n<p>or for <strong><a href="http://en.wikipedia.org/wiki/Sublime_Text" rel="noreferrer">Sublime Text</a></strong>:</p>\n\n<pre><code>git config --global core.editor "subl -n -w"\n</code></pre>\n'}, {'answer_id': 41315379, 'author': 'Zombo', 'author_id': 1002260, 'author_profile': 'https://Stackoverflow.com/users/1002260', 'pm_score': 0, 'selected': False, 'text': '<p>Here is a solution with Cygwin:</p>\n\n<pre class="lang-sh prettyprint-override"><code>#!/bin/dash -e\nif [ "$1" ]\nthen k=$(cygpath -w "$1")\nelif [ "$#" != 0 ]\nthen k=\nfi\nNotepad2 ${k+"$k"}\n</code></pre>\n\n<ol>\n<li><p>If no path, pass no path</p></li>\n<li><p>If path is empty, pass empty path</p></li>\n<li><p>If path is not empty, convert to Windows format.</p></li>\n</ol>\n\n<p>Then I set these variables:</p>\n\n<pre class="lang-c prettyprint-override"><code>export EDITOR=notepad2.sh\nexport GIT_EDITOR=\'dash /usr/local/bin/notepad2.sh\'\n</code></pre>\n\n<ol>\n<li><p>EDITOR allows script to work with Git</p></li>\n<li><p>GIT_EDITOR allows script to work with <a href="//hub.github.com" rel="nofollow noreferrer">Hub commands</a></p></li>\n</ol>\n\n<p><a href="//github.com/svnpenn/dotfiles/tree/2973070/editor" rel="nofollow noreferrer">Source</a></p>\n'}, {'answer_id': 41637069, 'author': 'guwer', 'author_id': 5144040, 'author_profile': 'https://Stackoverflow.com/users/5144040', 'pm_score': 3, 'selected': False, 'text': "<p>Edit .gitconfig file in c:\\Users\\YourUser folder and add:</p>\n\n<pre><code>[core]\neditor = 'C:\\\\Program files\\\\path\\\\to\\\\editor.exe'\n</code></pre>\n"}, {'answer_id': 53048541, 'author': 'JL_SO', 'author_id': 4026629, 'author_profile': 'https://Stackoverflow.com/users/4026629', 'pm_score': 3, 'selected': False, 'text': '<p>I needed to do <em>both</em> of the following to get Git to launch Notepad++ in Windows:</p>\n\n<ul>\n<li><p>Add the following to .gitconfig:</p>\n\n<pre><code>editor = \'C:/Program Files/Notepad++/notepad++.exe\' -multiInst -notabbar -nosession -noPlugin\n</code></pre></li>\n<li><p>Modify the shortcut to launch the Git Bash shell to run as administrator, and then use that to launch the Git Bash shell. I was guessing that the context menu entry "Git Bash here" was not launching Notepad++ with the required permissions. </p></li>\n</ul>\n\n<p>After doing both of the above, it worked. </p>\n'}, {'answer_id': 61967726, 'author': 'Gabriel Staples', 'author_id': 4561887, 'author_profile': 'https://Stackoverflow.com/users/4561887', 'pm_score': 0, 'selected': False, 'text': '<blockquote>\n  <p>Those of you using Git on Windows: What tool do you use to edit your commit messages, and what did you have to do to make it work?</p>\n</blockquote>\n\n<p>The tool that I find the most useful as both my <em>git editor <strong>and</strong> my general-purpose code editor</em>, in both Windows <em>and</em> Linux, is <a href="https://www.sublimetext.com/" rel="nofollow noreferrer">Sublime Text 3</a>. It works really well, but requires a little bit of setup to get it just right, so I\'ve fully documented that fully here:</p>\n\n<ul>\n<li><a href="https://stackoverflow.com/questions/2596805/how-do-i-make-git-use-the-editor-of-my-choice-for-commits/48212377#48212377">How do I make Git use the editor of my choice for commits? - Best settings for Sublime Text 3 as your Git editor (Windows &amp; Linux instructions)</a></li>\n</ul>\n\n<p>Side note about my main editor: for big projects I use Eclipse as my primary editor, and Sublime Text 3 as my git editor and additional file editor when I need to make use of its advanced features such as multi-cursor mode, vertical/column selection mode, etc. For small to medium projects I use just Sublime Text 3 by itself. For setup instructions for Eclipse, see <a href="https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/master/eclipse/Eclipse%20setup%20instructions%20on%20a%20new%20Linux%20(or%20other%20OS)%20computer.pdf" rel="nofollow noreferrer">my PDF document here</a>.</p>\n'}, {'answer_id': 65355708, 'author': 'Ruan Nawe', 'author_id': 6069435, 'author_profile': 'https://Stackoverflow.com/users/6069435', 'pm_score': 1, 'selected': False, 'text': "<p>to add sublime <code>git config --global core.editor &quot;'C:\\Program Files\\Sublime Text 3\\sublime_text.exe'&quot;</code></p>\n"}, {'answer_id': 68527047, 'author': 'cxxl', 'author_id': 1045800, 'author_profile': 'https://Stackoverflow.com/users/1045800', 'pm_score': 1, 'selected': False, 'text': '<p>I solved a similar issue using <code>GIT_EDITOR</code> variable and <code>notepad2</code> as editor.</p>\n<p>Solution 1: Set the environment variable <code>GIT_EDITOR</code> to <code>C:/tools/notepad2.exe</code>.  This works nicely, but git complains if the commit message has non-ASCII characters.</p>\n<p>Solution 2: Set <code>GIT_EDITOR</code> to <code>C:/tools/notepad2.exe //utf8</code>.  Notice the double slash in front of the program switch.  BTW: <code>-utf8</code> would have worked as well.</p>\n'}, {'answer_id': 71192747, 'author': 'Tal Jacob - Sir Jacques', 'author_id': 14427765, 'author_profile': 'https://Stackoverflow.com/users/14427765', 'pm_score': 0, 'selected': False, 'text': '<p>Say you want to configure <em>VsCode</em> to be your editor.\nDo the following:</p>\n<h2>Add the following lines to your <code>.gitconfig</code> file:</h2>\n<blockquote>\n<p>The default location of <code>.gitconfig</code> file is <code>C:\\Users\\USER_NAME\\.gitconfig</code></p>\n</blockquote>\n<pre><code>[core]\n  editor = code -w -n\n[diff]\n  tool = vscode\n[difftool &quot;vscode&quot;]\n  cmd = code -w -n --diff $LOCAL $REMOTE\n[merge]\n  tool = vscode\n[mergetool &quot;vscode&quot;]\n  cmd = code -w -n $MERGED\n</code></pre>\n<blockquote>\n<p>NOTE:</p>\n<ul>\n<li><code>-w</code> is mandatory, and tells <code>git</code> to wait for <em>vscode</em> to load.</li>\n<li><code>-n</code> is optional, and tells <code>git</code> to open <em>vscode</em> in a new-window.</li>\n</ul>\n</blockquote>\n<h3>In case you want to configure a custom path to the editor in Windows:</h3>\n<p>You need to replace the word <code>code</code> with <em>Path to \'.exe\' of VsCode</em>.</p>\n<p>For example:</p>\n<pre><code>[core]\n  editor = &quot;\'C:/Users/Tal/AppData/Local/Programs/Microsoft VS Code/Code.exe\'&quot; -w -n\n[diff]\n  tool = vscode\n[difftool &quot;vscode&quot;]\n  cmd = &quot;\'C:/Users/Tal/AppData/Local/Programs/Microsoft VS Code/Code.exe\'&quot; -w -n --diff $LOCAL $REMOTE\n[merge]\n  tool = vscode\n[mergetool &quot;vscode&quot;]\n  cmd = &quot;\'C:/Users/Tal/AppData/Local/Programs/Microsoft VS Code/Code.exe\'&quot; -w -n $MERGED\n</code></pre>\n<blockquote>\n<p>Note:</p>\n<ul>\n<li>You need to surround the path with <em>single-quotes</em> <code>\'\'</code>.</li>\n<li>The slashes in the path should be <em>forward-slashes</em> <code>/</code>.</li>\n</ul>\n</blockquote>\n<p>Or another example:</p>\n<pre><code>[core]\n    editor = \\&quot;C:\\\\Users\\\\Tal\\\\AppData\\\\Local\\\\Programs\\\\Microsoft VS Code\\\\Code.exe\\&quot; -w -n\n\n[diff]\n    tool = vscode\n[difftool &quot;vscode&quot;]\n    cmd = \\&quot;C:\\\\Users\\\\Tal\\\\AppData\\\\Local\\\\Programs\\\\Microsoft VS Code\\\\Code.exe\\&quot; -w -n --diff $LOCAL $REMOTE\n\n[merge]\n    tool = vscode\n[mergetool &quot;vscode&quot;]\n    cmd = \\&quot;C:\\\\Users\\\\Tal\\\\AppData\\\\Local\\\\Programs\\\\Microsoft VS Code\\\\Code.exe\\&quot; -w -n $MERGED\n</code></pre>\n<hr />\n<h3>UPDATE:</h3>\n<p><strong>VsCode supports now &quot;3-way merges&quot;!</strong>\nThe update was done in versions <a href="https://code.visualstudio.com/updates/v1_69#_3-way-merge-editor" rel="nofollow noreferrer">1.69.0</a> and <a href="https://code.visualstudio.com/updates/v1_70#_command-line-option-merge" rel="nofollow noreferrer">1.70.0</a>.\nSo now you can enable the VsCode &quot;mergetool&quot; to view 3-way merges.</p>\n<p>To do so, you need to update the line:</p>\n<pre><code>[mergetool &quot;vscode&quot;]\n      cmd = code -w -n $MERGED\n</code></pre>\n<p>with the new line:</p>\n<pre><code>[mergetool &quot;vscode&quot;]\n      cmd = code -w -n --merge $REMOTE $LOCAL $BASE $MERGED\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/10564', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/437/']