I typed the wrong name into Git, and it followed me like a shadow.
When you commit with the wrong user.name or user.email, it’s more than an annoyance. It pollutes history. It breaks blame tracking. It confuses maintainers. And yes — it can mess with compliance. You need a clean fix. You need to reset your Git user config, the right way, every time.
Local, Global, and System Configs
Git doesn’t just have one user configuration. It has three levels of it:
- Local: stored in
.git/config for a single repository - Global: stored in
~/.gitconfig for your user account - System: stored in
/etc/gitconfig and affects all users
When a commit is made, Git chooses the config from the most specific level, moving upward if none is found. If your problem is happening in one repo, check local. If it happens everywhere, check global or system.
Checking Current Config
Run:
git config --list --show-origin
See where each setting comes from. That’s how you know which file to edit.
Resetting Git User Config
Change Local Config
git config --local user.name "Correct Name"
git config --local user.email "correct@email.com"
Change Global Config
git config --global user.name "Correct Name"
git config --global user.email "correct@email.com"
Remove a Config
git config --unset --local user.name
Replace --local with --global as needed.
Fixing Old Commits
If you need to rewrite history:
git rebase -i HEAD~N
Change pick to edit on the commits you want to fix. Then amend:
git commit --amend --author="Correct Name <correct@email.com>"
git rebase --continue
Force push if this is on a shared branch — but know this rewrites history.
Automating Clean Config
Errors in Git config creep in when switching between projects, repos, and automation tools. If you’re working across multiple environments, reset configs before committing. Store them in simple scripts or dotfiles. Better yet, use tools to spin up fresh environments where configs are always correct.
That’s where hoop.dev comes in. You can see the results instantly — in minutes, live — without dragging old mistakes into new commits. Test, reset, and move on with a clean Git state every time.