You changed your name on one machine and Git still thinks you are Someone Else. Relax, this is a workplace hazard and not a personality crisis. This guide shows where Git stores its settings and how to edit system git, global git and local git config files without making the situation worse. You will learn which file wins when values collide and how to check origins with simple git commands and file edits.
Git looks at settings from three main places. They stack up from wide to narrow so narrow settings override wider ones.
/etc/gitconfig
. Editing often needs elevated privileges.~/.gitconfig
or ~/.config/git/config
on some systems..git/config
in the repo root.Before stabbing at files open a terminal and run this to see every value and where it came from
git config --list --show-origin
You can also ask for a specific scope when you want less output
git config --system --list
git config --global --list
git config --local --list
This removes a lot of guesswork. If the wrong email is appearing at commit time this command will show which config file set it.
Once you know which file to change open it in your editor of choice. Example editors are nano, vim or code. Remember system files usually need sudo or root rights.
/etc/gitconfig
~/.gitconfig
.git/config
from the repo rootIn the file you will see INI style sections and keys. A user block looks like this
[user]
name = Alice
email = alice@example.com
Aliases and core options use the same format. Make the edit, save, close, and breathe.
Check the specific setting after editing
git config --global user.name
git config --local user.email
git config --system core.editor
Then run the show origin list one more time to confirm which file provided the final value
git config --list --show-origin
If a setting keeps coming back or behaves oddly it might be set by a tool or a script. Look at system level configs first if you see behavior across many repos. If an individual repo acts up inspect .git/config
and check any hooks or CI configs that could rewrite behavior.
There you go. You should now be able to find and edit git config files with more confidence and less swearing. If all else fails blame your OS and make a backup before you start editing.
I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!
This is a dedicated watch page for a single video.