Failed to read Git log: fatal: unknown error occured while reading the configuration files

Hi,

a long time ago i enabled the enableGitInfo option which went fine nicely. Recently something had changed on my local development pc (and i’m sorry i couldn’t determine (yet) what exactly) and suddenly i get this when running hugo --enableGitInfo

Building sites … ERROR 2019/06/11 17:38:13 Failed to read Git log: fatal: unknown error occured while reading the configuration files

Running git log from the same user works perfectly fine in all variants so i’m wondering how i could debug the case further?

Thanks in advance for your help!

Best Regards, Uli

Try passing the -v flag to hugo to get more output.
If you see nothing useful there, it may be worth pushing all your changes to remote repo, then deleting your local repo and recloning.

Thanks for your reply. Unfortunately the “-v” doesn’t add any output in regards to that error. Also i did try to clone the repo again from my remote - didn’t lead to different results in the error output.

I debugged further and it seems as if the process has an issue with a global gitconfig. If i remove it, hugo works properly. We recently had a change where LFS is filtered by default:

root:/etc# cat gitconfig
[filter "lfs"]
        clean = git-lfs clean -- %f
        smudge = git-lfs smudge -- %f
        process = git-lfs filter-process
        required = true

The file itself has the usual permissions for a global gitconfig

root:/etc# ls -al gitconfig
-rw-r--r-- 1 root root 126 May  8 22:11 gitconfig

And also the output of git config --list look okay from my unprivileged user:

siruli:~$ git config --list --show-origin
file:/etc/gitconfig     filter.lfs.clean=git-lfs clean -- %f
file:/etc/gitconfig     filter.lfs.smudge=git-lfs smudge -- %f
file:/etc/gitconfig     filter.lfs.process=git-lfs filter-process
file:/etc/gitconfig     filter.lfs.required=true
[...]

Any further insights why that global gitconfig poses an issue? Thanks in advance!

Best Regards, Uli

I had the same issue. As a hopefully temporary workaround running hugo with the following enviroment variable set seems to be working:

GIT_CONFIG_NOSYSTEM=true

There is also a Github issue for that: https://github.com/gohugoio/hugo/issues/6226

2 Likes