Unable to execute git config --system --list command on Windows command prompt

Hello,

I’m getting below error when i try to run “git config --system --list” command from Windows command prompt.

                    fatal: unable to read config file ‘/usr/etc/gitconfig’

 Ex:

C:\Users\Administrator>git config --system -l
fatal: unable to read config file ‘/usr/etc/gitconfig’: No such file or directory

However, the command “git config --global–list” works fine.

C:\Users\Administrator>git config --global --list
http.sslverify=false

To my surprise, the command “git config --system --list” worked fine when i executed from the path where GIT was installed.

Ex:

C:\Program Files\Git\cmd>git config --system --list
http.sslverify=false
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean – %f
filter.lfs.smudge=git-lfs smudge – %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
core.editor=‘C:\Program Files (x86)\Notepad++\notepad++.exe’ -multiInst -notabbar -nosession -noPlugin

I want to know what i’m missing here. Why i’m getting “unable to read config file ‘/usr/etc/gitconfig’” error and why unix path /usr is used on Windows here ? I tried re-installing GIT but it couldn’t resolve the issue. Do let me know if any of you have any solution to this.

Note: I’m not seeing the same issue on another Windows machine. 

Kind Regards,

Sumanth Suvarna.

It is failing because:

  1. Git defines the system-wide configuration file as ${prefix}/etc/gitconfig
  2. ${prefix}/etc/gitconfig does not exist on your system

It doesn’t really matter though. If the file doesn’t exist, then it is treated as empty when calculating your active configuration. The only reason why you’re getting an error is because you’re insisting that it show you the system-wide configuration, so it is telling you that it doesn’t exist.

Thank you for the reply Lee.

I don’t understand why “${prefix}” is not set during GIT installation on Windows. However, i didnot see this issue on another windows machine. Everything worked fine as expected. 

I’m also facing another issue with git in CentOS. I installed GIT on CentOS 7.4 using “yum install git” command.

git --version

git version 1.8.3.1

However, there is no /etc/gitConfig file created. I tried uninstall and installing GIT again using yum but no success. The gitconfig file doesn’t exists under /etc/ directory. 

Any idea how to resolve this ?

You can create the file manually if you need for a system-wide configuration to exist. It isn’t a necessity though, so I’m not surprised the installer didn’t create one.