How do I show my global Git configuration?
How can you check and display your global Git configuration settings? What command helps you view details like username, email, and other preferences set up in your Git environment?
To view your global Git configuration, you can use the git config command with specific flags. Global configuration in Git usually includes details like your username, email, default editor, and other preferences that apply to all repositories on your system.
Here’s how you can check it:
Basic Command:
Run the following in your terminal:
- git config --global --list
- This displays all global configuration settings you’ve set, such as user.name, user.email, and more.
Check a Specific Setting:
If you only want to see one value, for example, your email:
git config --global user.email
- View Full Configuration File:
The global configuration is usually stored in a file located at:
~/.gitconfig
You can open it with any text editor to see or edit the settings directly:
cat ~/.gitconfig
Common Global Settings You’ll Find:
- user.name → Your Git username
- user.email → Your Git email
- core.editor → Default editor (e.g., vim, nano, VS Code)
- merge.tool → Merge tool preference
In summary, using git config --global --list is the quickest way to show your global Git configuration. It’s handy when you’re setting up Git on a new system or just want to confirm your current identity and preferences before committing to a repository.