113

I'm using msysgit 1.7.7.1 on Windows. I get an error when using git diff. What is causing this? Is there no diff tool included in msysgit? What should I do?

WARNING: terminal is not fully functional

3
  • 1
    A probable solution: kizzx2.com/blog/index.php/2009/01/07/…
    – Mr_Spock
    Oct 31, 2011 at 4:20
  • Ok, well msysgit uses git, it's kind of in the name. So I followed that with msys as the term and it worked! Post the explanation in a well formatted answer so I can award you some rep! Oct 31, 2011 at 4:28
  • in powershell run: $env:Term="xterm" Jun 22, 2015 at 13:19

7 Answers 7

186

If you are having issues in cmd.exe, for instance, see the warning here:

CMD.EXE without the TERM set correctly

Then simply set your environment variables and include TERM=msys. After that, each time you open a cmd.exe, your variable will be set correctly.

How to set your TERM environment variable

NOW YOU MUST RESTART YOUR SHELL (CMD.EXE). Just run a new one. And from there, you should have no more issues. Again:

CMD.EXE with the correct TERM set

8
  • Yeah, this definitely is. I'm on vista, and that totally solved it. Thanks teleball! Jul 24, 2012 at 23:17
  • 2
    Any idea where this problem comes from or what this message means? Oct 10, 2012 at 3:36
  • 7
    @AnthonyMastrean it means that the terminal does not support writing to different locations in the terminal window. Git diff wants to write all over the window, eg to write the next screenful, without doing a million backspaces to get the cursor in the right place each time.
    – jwg
    Jan 3, 2013 at 13:49
  • Since programs aren't changed, real problem is not terminal support, it is git (exactly less) been foolish by other program who defines TERM variable as some basic term, as @manojlds points out.
    – albfan
    Jul 21, 2014 at 7:58
  • 2
    If you are using Vagrant, this fix causes issues with the bash shell. E.g. nano will no longer work, giving error: 'msys': unknown terminal type
    – Sirrah
    Feb 9, 2015 at 16:18
64

For Git Bash, this can be fixed by adding the following line to ~/.bashrc:

export TERM=cygwin

-or-

export TERM=msys

The first seems to be the original by git for windows, the second a popular known form to "heal" as well.

The problem can be caused if some other program (like for example Strawberry Perl) sets the TERM system environment variables.

http://code.google.com/p/msysgit/issues/detail?id=184

11
  • Yes, but no such file exists in the file tree for git. The other answer worked and made sense. Oct 31, 2011 at 5:04
  • 1
    @Portaljacker - What do you mean worked? Close the git bash, open again and see if it works still?
    – manojlds
    Oct 31, 2011 at 5:05
  • 4
    Yeah, in windows setting the environment variable via set or the GUI (advanced settings as shown in the other answer) is the way to go.
    – cgp
    Jul 9, 2012 at 1:24
  • 11
    This answer is unsatisfying because the OP didn't say he was using bash and there is no requirement that git has to be run from bash. Personally I use the windows Command Prompt and I want a solution that works for that environment. Sep 24, 2012 at 21:12
  • 7
    @DavidGrayson Thread necro, I know, but you can do the same in Windows Command Prompt by using setx TERM msys. SETX (as opposed to just SET) writes the env variable to the registry.
    – rossipedia
    Nov 28, 2013 at 7:44
16

Above answers was not fully worked for me, so I did: Add

export TERM=msys 

to "[githome]/etc/profile" at the top but it made changes only for git bash. Then I added

@set TERM=msys

to "[githome]/cmd/git.cmd" after @setlocal (I installed only git run from command line). May be this decision not truly good but it works for me and there are not any terminal warnings. (I use git version 1.7.10.msysgit.1).

1
  • 2
    For windows, I just needed to set the environment variable TERM to msys, which can be done via SETX.
    – cgp
    Jul 9, 2012 at 1:24
14

The answer can be found here, in which the author of the solution claims that:

the environment variable TERM was set to dumb

that was instead of

TERM=cygwin

You can change that to

TERM=msys

to solve the problem at hand.

1
  • Turns out this answer only works for the current session of gitbash, had to change it to the other answer. Nov 1, 2011 at 2:15
7

I work in powershell and I have the git executable directly in my path.

None of the suggested answers worked, but I found a solution that works for me.

I added a line in my powershell profile:

$env:TERM="msys"

Which fixed the problem for me.

4
  • This doesn't seem to be an issue for me any more using git version 1.7.11.msysgit.1 I was able to remove the $env:TERM="msys" and re-enable the color extension in mercurial without issues. Oct 29, 2012 at 15:21
  • The conflict with other applications which use different terminals is the reason you should follow manojlds' answer and set TERM in Git Bash's own .bashrc rather than change the environment variable here, which will affect all programs.
    – jwg
    Jan 3, 2013 at 13:54
  • 1
    @jwg good point, but I use git all the time and I prefer powershell to bash, so having to run bash just to get color output was overkill for me. Jan 3, 2013 at 19:00
  • I added this to my cmder profile..ps1 file instead of my general powershell profile.
    – gerrard00
    Apr 6, 2016 at 16:10
6

A quick & dirty solution in my case turned out to be to use the --no-pager option.

By default, some git commands (like log) will use a pager like less if they expect the output to be long. Pagers require things like scrolling text up and down with the arrow keys, which sometimes doesn't work if the assumptions about what kind of terminal you're on are wrong (this is what the "not fully functional" means).

If you know ahead of time that your output will be short, or you just want it to dump output to the terminal and leave the scrolling up to your terminal program, you can override this and not use a pager at all, e.g.:

git --no-pager log
0

In case someone gets this launching bash from Git Extensions, check the setting for Path to linux tools.... Mine was set to C:\cygwin. Changing it to C:\Program Files (x86)\Git\bin\ fixed it for me. I didn't have to set the TERM variable to launch bash this way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.