I'm trying out Git on Windows. I got to the point of trying "git commit" and I got this error:
Terminal is dumb but no VISUAL nor EDITOR defined. Please supply the message using either -m or -F option.
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 Notepad++, but I can't figure out how to get Notepad++ set up as the %EDITOR%
in such a way that it works with Git as expected.
I'm not married to Notepad++. At this point I don't mind what editor I use. I just want to be able to type commit messages in an editor rather than the command line (with -m
).
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?
I've had difficulty getting git to cooperate with wordpad, KomodoEdit 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.
As a crutch, I've just been doing i.e.
to keep things moving. 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.
The GitGUI also isn't that bad. It takes a little bit of orientation, but after that, it works fairly well.
I had PortableGit 1.6 working fine but after upgrading to PortableGit-1.7 windows release had problems. Some of the git commands opens up Notepad++.exe fine but some don't, especially git rebase behaves differently.
Problem is some commands run windows cmd process some use unix cmd process. I want to give startup attributes to Notepad++ editor so need to have a customized script. My solution is this.
1) Create a script to run an appropriate text editor. Script looks weird but handles both windows and unix variation. c:/PortableGit/cmd/git-editor.bat
2) Set global core.editor variable Script was saved to git/cmd folder so its already in a gitconsole path, this is mandatory as full path may not work properly.
Now I can run git commit -a and git rebase -i master commands. Give it a try if you have problems in Git windows tool.
I've just had the same problem and found a different solution. I was getting
I've got
VISUAL=ec
, and a batch file calledec.bat
on my path that contains one line:This lets me edit files from the command line with
ec <filename>
, and having visual 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 agit commit
in ProcMon I saw it look in every folder on the path forec
and forec.exe
, but not forec.bat
. I added another environment variable (GIT_EDITOR=ec.bat
) and all was fine.I needed to do both of the following to get git to launch notepad++ in windoze:
-add the following to .gitconfig:
-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 npp with the required permissions.
After doing both of the above it worked.
Here is a solution with Cygwin:
If no path, pass no path
If path is empty, pass empty path
If path is not empty, convert to Windows format.
Then I set these variables:
EDITOR allows script to work with Git
GIT_EDITOR allows script to work with Hub commands
Source
Wordpad!
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).
That's using Git Bash on msysgit; I've not tried from the Windows command prompt (if that makes any difference).