Change email address in Git
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Changing the email address Git uses can mean two different things: updating future commits, or rewriting old commits that already have the wrong author metadata. Those are very different operations. The first is safe and simple configuration. The second rewrites history and should be done only with care.
Change the Email for Future Commits
If you just want new commits to use a different email address, update Git configuration.
For all repositories on your machine:
For only the current repository:
You can verify what Git will use:
That last command is useful because it shows where the active value came from.
Know the Difference Between Local and Global Scope
Use global config when the same identity should apply everywhere. Use local config when one repository needs a different address, such as a work repository versus a personal open-source repository.
That choice matters because developers sometimes change the global value to fix one project and then accidentally affect every future commit on the machine.
Update the Most Recent Commit
If the latest local commit already has the wrong email and has not been pushed yet, amend it after fixing config:
This replaces the author information on the latest commit using the current configured identity.
Rewrite Older Local History Carefully
If several local commits have the wrong email, you can rewrite them before sharing. Interactive rebase or a history-rewrite tool may be appropriate, but the key rule is simple: do this only before those commits are widely shared, or coordinate the rewrite with everyone affected.
The actual mechanics depend on how much history is involved. For a small recent branch, interactive rebase is usually enough. For large repository-wide cleanup, specialized history-rewrite tools are better.
For example, a repository-wide rewrite is a policy-level decision, not a quick local cleanup. Once other people have based work on the old commit ids, changing author metadata also changes commit hashes and affects their branches.
Remember That Config Does Not Change Old Commits Automatically
This is the most common misunderstanding. Running git config user.email ... only affects commits created after that change. Existing commits keep the author metadata they already have until you explicitly rewrite them.
That is why configuration changes and history rewriting should be treated as separate tasks, even if the motivation is the same.
Keep Hosting Accounts and Signing in Mind
Changing the email in Git does not automatically update your Git hosting profile, verified email status, or commit-signing setup. If your platform uses email matching for attribution or verification, make sure the new address is configured there too.
That is especially important if you expect commits to show up as verified or attributed to the correct account in a hosted UI.
The same caution applies to automated commits from CI or release bots. Those environments often have their own repository-local or injected Git identity settings that must be updated separately.
Common Pitfalls
- Changing the global email when only one repository needed a different identity.
- Expecting config changes to update old commits automatically.
- Rewriting published history without coordinating with collaborators.
- Forgetting to verify the active config source with
--show-origin. - Updating author email but ignoring hosting-account verification or signing configuration.
Summary
- Changing the email for future commits is a simple Git config change.
- Use global scope for machine-wide defaults and local scope for repository-specific identity.
- Existing commits keep their old metadata until you explicitly rewrite history.
- '
git commit --amend --reset-authoris the easiest fix for the latest local commit.' - Treat history rewriting as a separate, more careful operation than ordinary config changes.

