If your Git user name or email is staging a rebellion this is where you send it back to school. The git config list command is the first stop when configuration behaves like it has a secret life. Below we walk through viewing everything that applies to your repo or environment and how to trace the file that actually set a value.
Dump the current config that applies to your context and stop guessing. This shows key value pairs that Git is using right now.
git config --list
If your commit author looks wrong this is the quick check that will either calm you down or start a productive hissy fit.
Git likes to hide which file set a value. Add the flag that reveals the source file and enjoy the satisfaction of naming names.
git config --list --show-origin
That output tells you whether a setting came from a system file a global file or the local repository config. Very handy when a global setting is silently hijacking a repo level expectation.
When you only care about one thing use the getter style commands. These are the fast lane for troubleshooting a single key like user.email.
git config user.email
git config --get-all user.email
The first prints the effective value. The second will show multiple entries if someone went overboard and added more than one email.
Pick where a change should live so you do not accidentally announce a new identity to the whole machine.
git config --global user.name "Jane Doe"
git config --local --unset user.name
Use the global flag to change your user wide identity and use the local flag to make repository specific edits or removals.
There is a simple rule to keep in mind when things conflict. Settings in the repository override global settings and global settings override system settings. If a local config exists it wins. If not Git looks higher up the chain.
git config --list --show-origin
to see the winner and its file.--get-all
when multiple entries might exist.Recap in plain language If a setting surprises you dump the list show the origin and then adjust the correct scope. The commands above are the minimum viable toolkit for git troubleshooting of configuration. Now go fix the things and then pretend this was obvious all along.
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.