简体   繁体   中英

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, ie 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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM