You push code. The commit looks fine. Hours later, someone asks why the author is “root” or an email you’ve never seen. Now your commit history is polluted, blame tracking is broken, and automated pipelines misfire. All because your Git user config wasn’t what you thought it was.
Git’s user identity is set in layers. There’s the global config, local config, and sometimes even a system config. Global applies to all repositories for your user account. Local overrides it per repo. If you run git config user.name without --global, you’re changing only the current repo. If you forget this, you inherit values you didn’t mean to.
The danger grows when you jump between machines, containers, or CI runners. Maybe your workstation has your full name and work email. But your Docker image was built with defaults. Maybe your CI service injects a config to match the build agent. If you don’t check, you commit as whoever the environment says you are.
To inspect your identity, run:
git config --list --show-origin | grep user
This shows where each value came from. If you see multiple sources, you might have a conflict. Global configs are stored in ~/.gitconfig, local in .git/config, and system-wide in files deep in /etc or your OS’s config path.