Search code examples
gitcygwin

How to set default editor when using Git in Cygwin?


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?


Solution

  • 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.