How to Check Git Configuration: A Simple Guide

Git configuration settings control how Git behaves on your system, such as your username, email, editor, and more. Knowing how to check these settings is essential for troubleshooting, customizing your workflow, or verifying your identity on commits.

In this guide, you’ll learn how to view your Git configuration at different levels and interpret the results.


Understanding Git Configuration Levels

Git settings can be configured at three scopes:

LevelApplies ToCommand Option
SystemAll users on the machine--system
GlobalYour user account (all repos)--global
LocalThe current Git repository only(no option needed)

Step 1: View All Git Configuration

To see all settings Git is using, run:

git config --list

This shows a combined list from all config levels, with later settings overriding earlier ones.


Step 2: Check Specific Configuration Levels

  • Local repository settings (inside a repo):
git config --local --list
  • Global user settings (your account):
git config --global --list
  • System-wide settings (all users):
git config --system --list

⚠️ Note: You may need admin/root permissions to view system settings.


Step 3: View a Specific Config Key

To check a particular setting, like your username or email:

git config user.name
git config user.email

For global scope explicitly:

git config --global user.name

Step 4: Check Git Config File Locations

You can also directly open the config files:

  • Local: .git/config in your repository folder
  • Global: ~/.gitconfig or ~/.config/git/config
  • System: depends on your OS (e.g., /etc/gitconfig)

Bonus: Editing Git Config

To edit global config in your default text editor:

git config --global --edit

This opens the config file for manual changes.


Summary

TaskCommand
List all configgit config --list
List local configgit config --local --list
List global configgit config --global --list
Show specific keygit config <key> (e.g., user.email)
Edit global configgit config --global --edit

Why Check Git Config?

  • Confirm your identity for commits
  • Ensure Git uses the correct editor or merge tool
  • Troubleshoot Git behavior or authentication issues

Mastering Git configuration inspection helps you maintain smooth and personalized version control workflows.

Sharing Is Caring:

Leave a Comment