What are the different levels of git config (system, global, local), and how do they override each other?

Last updated 6 July 2026

Git config exists at three scopes (system, global, local) that layer on top of each other, with the most specific scope winning. This lets machine-wide defaults be overridden per-user and then per-repository.

  • System (--system): Applies to every user on the machine; stored in something like /etc/gitconfig.

  • Global (--global): Per-user settings in ~/.gitconfig; the usual place for name, email, aliases.

  • Local (--local): Per-repository in .git/config; the default when you run git config inside a repo.

  • Override order:

    • local beats global beats system (nearest scope wins).

    • Use git config --list --show-origin to see effective values and where each came from.

  • https://git-scm.com/book/be/v2/Customizing-Git-Git-Configuration
  • https://medium.com/@yadavprakhar1809/understanding-the-three-levels-of-git-config-local-global-and-system-e95c26aac8ee
  • https://git-scm.com/docs/git-config/2.13.7
  • https://git-scm.com/docs/git-config
  • https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-config
  • https://www.freecodecamp.org/news/git-config-how-to-configure-git-settings/
All Git interview questions