How to Use the Git Config List Command Example |Video upload date:  · Duration: PT4M19S  · Language: EN

Learn how to use git config list to view and debug Git configuration across local global and system scopes with practical commands and tips

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.

View all configuration entries

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.

Show where each value came from

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.

Fetch or filter a single key

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.

Set and unset values in the right scope

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.

Understand scope precedence

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.

Troubleshooting tips that do not waste your time

  • Start with git config --list --show-origin to see the winner and its file.
  • If name or email look wrong check both local and global files before panicking.
  • Use --get-all when multiple entries might exist.
  • Unset in the proper scope if you want to remove a value without surprising other projects.

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.