WindowsmacOSLinux

Where Is the Git Global Config File?

Git global .gitconfig location on Windows, macOS and Linux, and how it relates to system and repo configs.

Last updated

Your personal Git settings live in .gitconfig in your home folder. That file covers every repo you touch unless a repo local config overrides it.

Three levels exist: system (every user), global (you), local (.git/config in one repo). When settings disagree, local wins over global, and global wins over system.

Where Git stores this, by platform

Windows
%USERPROFILE%\.gitconfig

Usually C:\Users\[Name]\.gitconfig. Git for Windows resolves HOME to the user profile. Newer setups may use $XDG_CONFIG_HOME/git/config instead when .gitconfig is absent.

macOS
~/.gitconfig

Same file for Terminal and GUI clients in most setups. The system file sits at /etc/gitconfig or inside the Xcode tools path.

Linux
~/.gitconfig

Falls back to ~/.config/git/config when .gitconfig does not exist. The system file is /etc/gitconfig. Run git config with the list and show origin flags to confirm which file a value comes from.

Frequently asked questions

How do I prove which config file a setting comes from?

List settings with origin info. That prints each value alongside the file it was read from, which settles HOME disputes on Windows fast.

Why do I have two .gitconfig files on Windows?

Different shells resolve HOME differently (profile folder versus MSYS or Cygwin home). Pick %USERPROFILE%\.gitconfig as the master and symlink the others to it.

Notice an outdated path? Let us know.