Why is git log empty even if a log file exists?

git log does not produce anything, even if at least " .git/logs/refs/heads " contains the latest commit .git/logs/refs/heads .

System:
I uninstalled and reinstalled git in my ubuntu installation.

 Linux ap 3.0.0-17-generic #30-Ubuntu SMP Thu Mar 8 20:45:39 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux 
+4
source share
4 answers

I got the same error. The problem was that I defined the default pager in the wrong place in .bashrc :

 export PAGER=/usr/bin/more 

Running git log did not return a result. I changed the location to /bin/more and it has been fixed.

+5
source

git log does not refer to ".git / logs /". git log reads ".git / refs /"

git reflog reads ".git / logs /", which is written when the branch tip is updated.

+3
source

Try cloning your repo again and see if the error persists.

Make sure that the GIT_DIR or GIT_WORK_TREE environment variables are not defined, otherwise the git log will not work with the git repo you are considering.

Make sure there are no aliases for git or (for that matter) no git aliases for ' log '.

0
source

As Diego Pino said, the problem may be related to the git core.pager parameter.

I write this because I had the same problem, but the matter was different. After specifying a hint for setting an empty value in the settings section of git core.pager I lost the ability to use git log , I mean that the output of the command is empty. The purpose of this parameter was to not use a pager and just print everything on stdout, but something went wrong. This was something like this in .gitconfig :

 [core] pager = " " 

The solution could be to set the core.pager parameter in .gitconfig globally (in the user's home folder .gitconfig ) or in the context of the entire system (in / etc / gitconfig), respectively:

 git config --global core.pager more 

or

 sudo git config --system core.pager more 

I prefer more as a pager for long output, but the default pager in my git installation was less - choose what applies to you.

0
source

Source: https://habr.com/ru/post/1433108/


All Articles