Jun Yin
Jun Yin

Reputation: 2419

Unable to find machine level gitconfig file on Mac

I am using macOS High Sierra version 10.13.4, which comes with git installed. I was trying to find my machine level gitconfig file.

Typed: $ git config --system --list

Got: fatal: unable to read config file '/etc/gitconfig': No such file or directory

Why is this happening? How can I find it?

The user level git file exists at ~/.gitconfig though.

Upvotes: 1

Views: 1516

Answers (1)

merlin2011
merlin2011

Reputation: 75639

This is happening because you do not have the file /etc/gitconfig.

The error will go away if you simply create the file. Since it is a system directory, you will need sudo.

sudo touch /etc/gitconfig

Without that file, this error reproduces even on my Ubuntu system, so it's not an OSX-specific issue.

git config --system --list
fatal: unable to read config file '/etc/gitconfig': No such file or directory
sudo touch /etc/gitconfig
git config --system --list
# No output

Upvotes: 1

Related Questions