Git Config Location Where does Git store config? |Video upload date:  · Duration: PT59S  · Language: EN

Find where Git keeps system local and user configuration files and how to inspect effective values and file locations

Where Git keeps its config files

Git stores configuration in three scopes that you should know about if you enjoy understanding why your commits look like they belong to someone else. The scopes are system global and local. The system file applies to every user on the machine and is usually at /etc/gitconfig. The per user global file lives at ~/.gitconfig or in modern setups at ~/.config/git/config. The repo specific local file is at .git/config inside the project folder.

How to see which file set a value

Before you start panicking about mysterious settings run the built in detective command

git config --show-origin --list

This prints each config key along with the exact file path that defined it. It will save you from a lot of blind guessing and blame assigning.

Precedence and common gotchas

Config precedence goes local then global then system so a value in .git/config overrides the same key in ~/.gitconfig. That is why your name or email can still be wrong for a single repo even though you set it globally.

Quick examples

  • Set your global name so you do not need to type it for every new repo
  • git config --global user.name YourName
  • Check the effective value for a key
  • git config user.email

Troubleshooting steps that do not involve smashing your keyboard

  • Run git config --show-origin --list to see the source file for each key
  • Open the repo level file at .git/config to inspect overrides
  • Check for environment based overrides such as the GIT_DIR variable or other core environment variables that can redirect which config is used
  • Remember system level files at /etc/gitconfig can be set by admins for all users

Why this matters for GitHub and version control

If your commits show the wrong author on GitHub or you have odd behavior in your version control workflow the config location and precedence are usually the culprit. Fix the right file and the problem goes away. If it does not then you probably missed an environment override or a repo specific setting.

Final tip

When in doubt run git config --show-origin --list first. It tells you where to look and saves you from guessing which config file is haunting your repo. Now go fix the config and pretend this was all part of a planned refactor.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.