Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 (i.e. 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?

like image 759
Sirrah Avatar asked Feb 09 '15 17:02

Sirrah


1 Answers

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)

like image 194
Torben Knerr Avatar answered Sep 19 '22 23:09

Torben Knerr