I am using the Git
CLI in Cygwin
on Win7
. I have a problem when I issue a command that requires editor interaction, such as
git commit --amend
In Cygwin, the command simply hangs and I must do Ctrl-Z
to get the next prompt. The commit does not go through.
I tried to set the default editor to vi
:
git config --global core.editor "vi"
But that did not work.
In Windows Terminal (DOS-like CLI), it redirects to a vi-like editor fine, i.e. business as usual. But it doesn't work in Cygwin. I prefer using Cygwin over Terminal because I was having some other issues in Terminal (wasn't showing which remotes the locals are tracking etc.)
How do I set the default editor when using Git on Cygwin?
The command to do this is git config --global core. editor "nano" . You can change the highlighted section with your editor of choice!
Yes, Git uses Vim as its editor while committing your changes. Show activity on this post. Doing so launches your editor of choice. (This is set by your shell's $EDITOR environment variable – usually vim or emacs, although you can configure it with whatever you want using the git config --global core.
As per this answer, I did the following:
git config --global core.editor "D:/homex/SFTWR/cygwin/bin/vi.exe"
D:/homex/SFTWR/cygwin
is the location of my Cygwin
install. I am still perplexed why it is taking a Windows path when it's running in the Cygwin shell.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With