Windows Git: unknown error occurred while reading the configuration files

Viewed 2444

Prior questions like Can't use git: "git fatal: unknown error occurred while reading the configuration files" talk about this error message:

G:\dev\some-repo> git status
fatal: unknown error occurred while reading the configuration files

…and answers go through various basic troubleshooting around finding config files, making sure those paths aren't directories, etc.

I've verified that my C:\Users\chas\.gitconfig file is a file, and aside from that, all the configuration files can be read as far as I can tell -- or, at least, I see values from all of the locations I'm aware of:

$ git config -l --show-origin
fatal: error processing config file(s)
file:"G:\\Downloads\\Git\\mingw64/etc/gitconfig"        core.symlinks=false
file:"G:\\Downloads\\Git\\mingw64/etc/gitconfig"        core.autocrlf=true
file:"G:\\Downloads\\Git\\mingw64/etc/gitconfig"        color.diff=auto
file:"G:\\Downloads\\Git\\mingw64/etc/gitconfig"        color.status=auto
file:"G:\\Downloads\\Git\\mingw64/etc/gitconfig"        color.branch=auto
file:"G:\\Downloads\\Git\\mingw64/etc/gitconfig"        color.interactive=true
file:"G:\\Downloads\\Git\\mingw64/etc/gitconfig"        pack.packsizelimit=2g
file:"G:\\Downloads\\Git\\mingw64/etc/gitconfig"        help.format=html
file:"G:\\Downloads\\Git\\mingw64/etc/gitconfig"        http.sslcainfo=/ssl/certs/ca-bundle.crt
file:"G:\\Downloads\\Git\\mingw64/etc/gitconfig"        diff.astextplain.textconv=astextplain
file:"G:\\Downloads\\Git\\mingw64/etc/gitconfig"        rebase.autosquash=true
file:"G:\\Downloads\\Git\\mingw64/etc/gitconfig"        filter.lfs.clean=git-lfs clean -- %f
file:"G:\\Downloads\\Git\\mingw64/etc/gitconfig"        filter.lfs.smudge=git-lfs smudge -- %f
file:"G:\\Downloads\\Git\\mingw64/etc/gitconfig"        filter.lfs.process=git-lfs filter-process
file:"G:\\Downloads\\Git\\mingw64/etc/gitconfig"        filter.lfs.required=true
file:"G:\\Downloads\\Git\\mingw64/etc/gitconfig"        credential.helper=manager
file:C:/Users/chas/.gitconfig   user.name=Chas Emerick
file:C:/Users/chas/.gitconfig   user.email=chas@cemerick.com
file:C:/Users/chas/.gitconfig   push.default=matching

Note:

  • fatal: error processing config file(s) message preceding all of the config entries
  • All of the above happens whether I'm in a repo or not
  • that my user-level file appears to be getting consumed properly
  • removing C:\Users\chas\.gitconfig entirely does not resolve the problem
  • The listing above is from using a self-contained/"portable" git executable/environment and using git-bash; the same problem persists when git is installed, and using git-bash from there, or git via cmd.exe.
  • Git version: 2.15.0; Windows 10 Pro, version 1709, OS build 16299.19

Help?

1 Answers

Double-check if

  • the error persists when using git config -l --show-origin outside of any git repo (in which case that might be related to the local repo you are in)
  • the error persists when using a simplified PATH (to rule out any other program side-effect)

There should 3 files (in addition to a possible local repo config file):

file:"C:\\ProgramData/Git/config"                     core.symlinks=false
...
file:"C:\\prgs\\git\\latest\\mingw64/etc/gitconfig"   core.symlinks=false
...
file:C:/Users/VonC/.gitconfig                         core.autocrlf=false

Or at least, the first one (C:\\ProgramData) should not point to a non-existent file.
See more at "Windows-specific Git configuration settings; where are they set?".
The page "Getting Started - First-Time Git Setup" mentions:

On Windows systems, Git looks for :

  • the .gitconfig file in the $HOME directory (C:\Users\$USER for most people).
  • It also still looks for /etc/gitconfig, although it’s relative to the MSys root, which is wherever you decide to install Git on your Windows system when you run the installer.
  • If you are using version 2.x or later of Git for Windows, there is also a system-level config file at C:\Documents and Settings\All Users\Application Data\Git\config on Windows XP, and in C:\ProgramData\Git\config on Windows Vista and newer.
    This config file can only be changed by git config -f <file> as an admin.

See git-for-windows/git commit 153328b, regarding the discussion between the libgit2 and the Git for Windows project, on how they could share Git configuration to avoid duplication (or worse: skew).

Related