THE GITHTML FIELD GUIDE
Find where a Git configuration setting comes from
Use git config --show-origin --show-scope to inspect where a setting was read and which configuration scope supplied it. A repository-local value can override a global default, and included configuration files can add more values. Inspect the specific key before editing anything; changing a global setting may affect unrelated repositories.
Locate the effective setting
Git configuration is layered. A machine-level default, your user configuration, a repository’s own configuration, and command-specific inputs can all participate. This explains why setting an editor or author email globally may appear to have no effect in one project. The right question is not merely whether the value exists, but which source wins for the command being run.
Start with the exact key involved. For an unexpected email, inspect user.email; for an unexpected pull strategy, inspect pull.rebase and pull.ff. A full configuration listing can reveal credential helper details or private remote addresses, so avoid posting it publicly without review. Narrow inspection is usually more useful and safer.
Inspect scope before choosing a correction
The commands below inspect identity and pull behavior without changing configuration. --get-all is useful when a key may have multiple values. Some configuration variables intentionally accumulate values rather than behaving like a single replacement, so read the variable’s documentation before assuming the last printed line is the whole story.
- Identify the file and scope that introduced the unexpected value. If it is local to this repository, prefer a local correction over changing every project.
- Check conditional includes when only repositories in a particular folder behave differently. Path-sensitive configuration can be intentional for work and personal identities.
git config --show-origin --show-scope --get-all user.email
git config --show-origin --show-scope --get-all pull.rebase
git config --show-origin --show-scope --get-all pull.ffVerify the behavior, not just the edited file
After a narrowly scoped update, rerun the same inspection from the same repository and operating-system account. A shell environment or wrapper may supply additional settings, so checking a text file alone does not prove what the next Git process will use. Reproduce the original command’s context without repeating a destructive operation merely to test configuration.
For example, fixing the author email should be verified through effective configuration and the next appropriate commit’s metadata. Fixing a pull policy should be checked against the project’s collaboration rules before any integration occurs. Configuration is a persistent behavioral choice; avoid setting a preference globally just because an error message offered that syntax. Record why a project-specific override exists so a future maintainer does not remove a deliberate exception while cleaning up settings.
Keep a note of the original value before making a persistent change. That makes reversing a mistaken configuration edit straightforward without reconstructing settings from memory.
Sources and further reading
AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.