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

ⅰ亾dé卋堺 提交于 2019-12-17 15:13:22

问题


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


回答1:


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




回答2:


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:




回答3:


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




回答4:


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.




回答5:


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.




回答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



回答7:


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.



来源:https://stackoverflow.com/questions/7949956/why-does-git-diff-on-windows-warn-that-the-terminal-is-not-fully-functional

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