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

亡梦爱人 提交于 2019-11-28 03:17:09
manojlds

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

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

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.

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

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

Mr_Spock

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.

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.

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!