2

Certain commands, such as git log result in an annoying error message before the expected output is produced on screen. The error message looks like this:

C:\CNC>git log
WARNING: terminal is not fully functional
- (press RETURN)commit 5d2076175b...

Now let me differentiate this question from similar questions and show what I've already tried.

  • I'm using git portable on Windows; version 2.22.0.windows.1

  • Windows 10, Version 10.17763

  • I'm not using git-bash and for the sake of this question, assume it is not possible. I am specifically asking for a solution with git-cmd.exe.

  • I do not have admin access on my machine. Other questions have people setting an environment variable set TERM=msys. I can do this under my user profile, but not at the system level. I have set TERM at the user level, but it doesn't solve the problem.

scottmwyant
  • 305
  • 1
  • 2
  • 9

2 Answers2

1

I only use the Git portable edition, and do not see this issue.

vonc@VONCA D:\git
> git version
git version 2.21.0.windows.1

I did recommended set TERM=msys in 2014, but that should not be needed nowadays (2019).

Check if the issue persists when using Git in a simplified PATH in your regular CMD session:

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
set GIT_HOME=C:\Path\to\Git
set PATH=%GIT_HOME%;%GIT_HOME%\bin;%GIT_HOME%\usr\bin;%GIT_HOME%\mingw64\bin;%PATH%

git log

git-for-windows/git issue 1572 mentions:

The warning message is not from git, but from less, which is used as the default pager by git.

If you specify less -d as pager, less will not warn about your terminal:

$ less --help | grep -A 1 dumb
  -d  ........  --dumb
                  Dumb terminal.

You can configure this with: git config --global core.pager "less -d"

you can also use: git config --global core.pager "TERM=cygwin less".
This will give you a more functional pager.

Yet another solution is to create a batch file:

$ cat less.bat
@set TERM=
@less.exe %*

And use it as your pager:

git config --global core.pager "/c/path/to/batch/less.bat".
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Still happening with simplified PATH variable. – scottmwyant Aug 04 '19 at 10:33
  • @scottmwyant Is this a regular CMD or an emulator like Cmder? And maybe Windows 10 17763 is a bit old. I use a 1903, build 18362. – VonC Aug 04 '19 at 10:35
  • Plain old CMD. Yes, unfortunately, I was just upgraded from Win7 to 10 two months ago... – scottmwyant Aug 04 '19 at 10:38
  • @scottmwyant At work then. I understand, I use a Windows 10 1710 at work too. But I don't have this issue. Can you list somewhere your environment variables, with `set`? – VonC Aug 04 '19 at 10:39
  • @scottmwyant I see your simplified path is missing mingw64\bin (which I forgot). Can you retry with `C:\...\git\mingw64\bin`? – VonC Aug 04 '19 at 10:53
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/197444/discussion-between-scottmwyant-and-vonc). – scottmwyant Aug 04 '19 at 10:55
  • excellent! What worked for me is the `git config --global core.pager "less -d"` – scottmwyant Aug 04 '19 at 12:25
1

In my case, upgrade my old Windows 7 desktop to Windows 10, and found out TERM system variable had been added by Strawberry Perl and set to dumb decades ago.

So remove the TERM system variable from Windows 10 environment variables settings fix this issue without any further updates.

Now, type echo $TERM shown the default value: xterm-256color works for everything...

zs21cn
  • 63
  • 6