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

Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
Portaljacker
  • 3,102
  • 5
  • 25
  • 33
  • 1
    A probable solution: http://kizzx2.com/blog/index.php/2009/01/07/cygwin-warning-terminal-is-not-fully-functional/ – Mr_Spock Oct 31 '11 at 04: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! – Portaljacker Oct 31 '11 at 04:28
  • in powershell run: $env:Term="xterm" – Anton Soradoi Jun 22 '15 at 13:19

7 Answers7

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

teleball
  • 4,602
  • 6
  • 37
  • 38
  • Yeah, this definitely is. I'm on vista, and that totally solved it. Thanks teleball! – J Cole Morrison Jul 24 '12 at 23:17
  • 2
    Any idea where this problem comes from or what this message _means_? – Anthony Mastrean Oct 10 '12 at 03: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 03 '13 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 '14 at 07:58
  • For windows users, only opened cmds doesn't contain new variable TERM setted with GUI, so if close some of them is a problem, just define it manually, avoiding lost whatever history, path location, or terminal log which is important to you. – albfan Jul 21 '14 at 08:01
  • 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 09 '15 at 16:18
  • @Sirrah *very* good point also if you ssh from e.g. powershell into a linux box, programs like nano don't always know 'msys'. Using 'cygwin' seems to be the proper answer: git on windows handles it well and most shells should do to – stijn Feb 04 '16 at 08:34
  • I don't have admin access to edit environment variables but I can edit them for my user profile. I added the TERM variable with a value of msys but I'm still getting the "not fully functional error". Also, there is no TERM variable set under the system variables. Also, I'm using the portable version of git for windows. – scottmwyant Aug 01 '19 at 12:05
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

hakre
  • 193,403
  • 52
  • 435
  • 836
manojlds
  • 290,304
  • 63
  • 469
  • 417
  • Yes, but no such file exists in the file tree for git. The other answer worked and made sense. – Portaljacker Oct 31 '11 at 05:04
  • 1
    @Portaljacker - What do you mean worked? Close the git bash, open again and see if it works still? – manojlds Oct 31 '11 at 05:05
  • The git diff command actually works now and doesn't throw that warning. the other answer made it happen. I found your solution in a google search and could not find a file with that name on my hard drive at all, so how could I change it? – Portaljacker Oct 31 '11 at 05:13
  • @Portaljacker - If it works fine, great! ( the .bashrc is a bash init file and can create it if it is not there) – manojlds Oct 31 '11 at 05:17
  • SO I had to change your answer to be the right one, since the other one stops when you close and re-open gitbash. – Portaljacker Nov 01 '11 at 02:14
  • This seems to work in linux as well. I added `export TERM=xterm` in my .bashrc file to replace the default 'dumb' terminal that emacs uses. – yuvilio Jun 18 '12 at 19:59
  • 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 09 '12 at 01: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. – David Grayson Sep 24 '12 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 '13 at 07:44
  • I didn't have a `~/.bashrc` file after using Git for Windows for quite some time, but creating one and using this answer fixed my problem. – cjm Jul 07 '15 at 15:05
  • `export TERM=cygwin` should be preferred over `export TERM=msys`, even if you are not running a full-blown Cygwin installation. Both will work locally in Git bash, but `TERM=msys` is not recognized by most remote systems, while `TERM=cygwin` is recognized. Use `TERM=cygwin` if you `ssh` to another system from a Git Bash shell. – Doug Schmidt Sep 09 '15 at 20:12
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).

Anatoly R
  • 161
  • 1
  • 3
  • 2
    For windows, I just needed to set the environment variable TERM to msys, which can be done via SETX. – cgp Jul 09 '12 at 01: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.

Ryan Lundy
  • 204,559
  • 37
  • 180
  • 211
Mr_Spock
  • 3,815
  • 6
  • 25
  • 33
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.

John Weldon
  • 39,849
  • 11
  • 94
  • 127
  • 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. – John Weldon Oct 29 '12 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 03 '13 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. – John Weldon Jan 03 '13 at 19:00
  • I added this to my cmder profile..ps1 file instead of my general powershell profile. – gerrard00 Apr 06 '16 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
Felix
  • 433
  • 4
  • 8
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.

Clay
  • 10,885
  • 5
  • 47
  • 44