Find and edit system, global & local Git config files |Video upload date:  · Duration: PT4M28S  · Language: EN

Locate and edit Git system global and local config files with commands file paths and verification steps for correct user and repo settings

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.

Where Git reads settings

Git looks at settings from three main places. They stack up from wide to narrow so narrow settings override wider ones.

  • System level files apply to the whole machine. Common path is /etc/gitconfig. Editing often needs elevated privileges.
  • Global or user level applies to one developer account. File is ~/.gitconfig or ~/.config/git/config on some systems.
  • Local or repo level applies only to a repository. File is .git/config in the repo root.

Find the origin of a setting

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.

Open and edit the right file

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.

  • System file path for most systems is /etc/gitconfig
  • User file is ~/.gitconfig
  • Repository file is .git/config from the repo root

In 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.

Verify your change took effect

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

Quick rules to avoid grief

  • If you want machine wide defaults edit the system file
  • If you want settings for your user account edit the global file
  • If you want repo specific overrides edit the local file
  • Always run show origin to see who set what before changing anything

Troubleshooting tips

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.