Why does git diff on Windows warn that the “terminal is not fully functional”?

后端 未结 7 710
南方客
南方客 2020-12-04 09:43

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? Wha

相关标签:
7条回答
  • 2020-12-04 10:23

    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

    0 讨论(0)
  • 2020-12-04 10:23

    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.

    0 讨论(0)
  • 2020-12-04 10:31

    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 讨论(0)
  • 2020-12-04 10:33

    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

    0 讨论(0)
  • 2020-12-04 10:41

    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.

    0 讨论(0)
  • 2020-12-04 10:44

    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).

    0 讨论(0)
提交回复
热议问题