How do I show my global Git configuration?
Categories:
Understanding and Displaying Your Global Git Configuration

Learn how to view, interpret, and manage your global Git configuration settings, which apply across all your repositories.
Git uses a hierarchical configuration system that allows you to set preferences at different levels: system, global (user), and local (repository). The global configuration is particularly important as it defines your default settings for all repositories on your system, unless overridden by a local repository-specific configuration. This article will guide you through how to display and understand these crucial global settings.
The Three Levels of Git Configuration
Before diving into how to view your global configuration, it's helpful to understand the different scopes Git uses for its settings. Each level can override the one above it, providing flexibility in how you manage your Git environment.
flowchart TD A[System-wide Config] --> B[Global (User) Config] B --> C[Local (Repository) Config] C --> D[Effective Git Settings] subgraph Configuration Hierarchy A -- "Lowest Priority" --> B B -- "Overrides System" --> C C -- "Highest Priority" --> D end
Git Configuration Hierarchy
Here's a quick breakdown of each level:
- System-wide (
--system
): This configuration applies to every user on the system and all their repositories. It's typically located in/etc/gitconfig
on Linux/macOS orC:\ProgramData\Git\config
on Windows. It's often managed by system administrators. - Global (
--global
): This is your user-specific configuration, applying to all repositories you work with. It's stored in~/.gitconfig
(or~/.config/git/config
) on Linux/macOS, andC:\Users\<YourUsername>\.gitconfig
on Windows. This is the focus of this article. - Local (
--local
): This configuration is specific to a single Git repository. It's found in the.git/config
file within the repository's root directory. These settings override both global and system configurations for that particular repository.
Viewing Your Global Git Configuration
The primary command to view your global Git configuration is git config --global --list
. This command will output all the settings defined in your global configuration file. You can also inspect the file directly.
git config --global --list
Listing all global Git configuration settings
This command will display output similar to the following, showing your user name, email, default editor, and any other global settings you've configured:
user.name=Your Name
user.email=your.email@example.com
core.editor=vim
color.ui=auto
init.defaultbranch=main
Example output of global Git configuration
git config --list
. This will show you the effective configuration for your current repository, with local settings overriding global, and global overriding system.Inspecting the Global Configuration File Directly
While git config --global --list
is convenient, sometimes you might want to view the raw configuration file. This file is a plain text file and can be opened with any text editor. Its location depends on your operating system.
1. Locate the file
On Linux/macOS, your global Git configuration is typically located at ~/.gitconfig
or ~/.config/git/config
. On Windows, it's usually C:\Users\<YourUsername>\.gitconfig
.
2. Open the file
Use a text editor to open the file. For example, on Linux/macOS, you can use cat ~/.gitconfig
or less ~/.gitconfig
to view its contents in the terminal, or nano ~/.gitconfig
to open it in a basic editor.
# On Linux/macOS
cat ~/.gitconfig
# On Windows (from Git Bash)
cat ~/.gitconfig
Viewing the global Git configuration file directly
The content of this file will look similar to this, structured in sections with key-value pairs:
[user]
name = Your Name
email = your.email@example.com
[core]
editor = vim
[color]
ui = auto
[init]
defaultBranch = main
Example content of the ~/.gitconfig file
git config --global <key>
, for example, git config --global user.name
will output just your configured user name.