git log output gets directly dumped, without going through a pager

Issue

enter image description here

As the GIF above shows, running git log in my WSL2 Ubuntu suddenly became noninteractive. It would show all the logs at once (while the Windows counterpart seemed to be working fine). git has already been updated to the latest version, and this behavior is also present when running WSL2 by itself, i.e., not using the Windows Terminal app. Any ideas on what caused the issue? Any help is appreciated. Thanks!

Solution

Following the doc for git config core.pager (from git help config) :

core.pager

Text viewer for use by Git commands (e.g., less). The value is meant to be interpreted by the shell. The order of preference is the $GIT_PAGER environment variable, then core.pager configuration, then $PAGER, and then the default chosen at compile time (usually less).

check the values of :

echo $GIT_PAGER
git config core.pager
echo $PAGER

If the pager is indeed less, confirm that less is installed (this is very probably the case: less --version), and then check the environment variables that affect LESS :

env | grep LESS

it could be that some of these options turn off the paging of less.

Finally, if all the values above look like usual values, check if your terminal and tty report correct values (echo $TERM, I just fished stty size from this question, etc …).

Answered By – LeGEC

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published