Where Is the Git Config File Located?
Git reads settings from a system file, your global .gitconfig, the XDG config file, and each repo's .git/config. Paths for Windows, macOS and Linux.
Last updated
Git reads configuration from several files in a fixed order, and later files beat earlier ones. The system file sets defaults for every account on the machine, your global file holds your name, email and aliases, and each repository has a local file that can override both.
You rarely need to open any of them by hand. Run git config --list --show-origin and Git prints every active setting next to the file it came from, which settles arguments about where a value actually lives. Writing with --global targets the user file, while changing the system file needs admin rights.
Where Git stores this, by platform
%USERPROFILE%\.gitconfig
Usually C:\Users\[Username]\.gitconfig. Machine-wide defaults sit in C:\ProgramData\Git\config, and the install tree has its own copy at <Git install>\etc\gitconfig (C:\Program Files\Git\etc\gitconfig for a default install). Note that the global file lives in the profile root, not under .config.
~/.gitconfig
System-wide defaults are in /etc/gitconfig. Git also reads ~/.config/git/config if you created it, before it reads ~/.gitconfig, and where both set the same single-valued key the ~/.gitconfig copy wins.
~/.gitconfig
Same shape as macOS: /etc/gitconfig for system defaults, ~/.config/git/config (the XDG location, used when it exists) read first among the user files, then ~/.gitconfig, then .git/config inside the repository you are working in.
Frequently asked questions
Where is the git config file on Windows?
Your global one is %USERPROFILE%\.gitconfig, typically C:\Users\YourName\.gitconfig. The machine-wide file is C:\ProgramData\Git\config, and every repository has its own .git\config. git config --list --show-origin prints them all with their values.
What is the difference between global and local git config?
Local settings live in .git/config inside one repository and override everything for that repo. Global settings in ~/.gitconfig apply to every repository you use on the machine, and the system file sets the baseline underneath both.
How do I see which git config file a setting came from?
Run git config --list --show-origin from inside the repository. Every line shows the file that supplied the value. Add --show-scope and Git also labels the level: system, global or local.
Notice an outdated path? Let us know.