Sirrah
Sirrah

Reputation: 1701

Setting TERM environment variable in Windows Powershell that works with ssh+Bash 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?

Upvotes: 9

Views: 10528

Answers (1)

Torben Knerr
Torben Knerr

Reputation: 794

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)

Upvotes: 6

Related Questions