简体   繁体   中英

How to set TERM environment variable in Windows so that it works with Bash via SSH and locally with Git?

Background:

When using my Windows version of git in Powershell I found that I got the error "terminal is not fully functional" so I used the second solution posted here (ie change TERM to msys) to fix the problem.

However, this caused a secondary problem that when SSH'd into my Vagrant box, command line apps like Vim, Nano and even Clear would not run, producing errors "msys: unknown terminal type."

I then attempted to change TERM to "ansi" and I got better results during ssh, in that the apps would run fine, but there are still formatting errors.

Question:

Is there a setting for TERM in windows environment variables that will work properly for both my Windows copy of Git and the Vagrant VM Bash shell via SSH?

The combination that works best for me is:

:: set proper TERM to not break `vagrant ssh` terminal, 
:: see https://github.com/tknerr/bills-kitchen/issues/64
set TERM=cygwin

:: trick vagrant to detect colored output for windows, see here:
:: https://github.com/mitchellh/vagrant/blob/7ef6c5d9d7d4753a219d3ab35afae0d475430cae/lib/vagrant/util/platform.rb#L89
set ANSICON=true

:: mute the cygwin warning which otherwise comes on `vagrant ssh`
set CYGWIN=nodosfilewarning

(excerpt from the set-env.bat file from bills-kitchen )

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