Config
Git - Quick Reference
3 min read
Published Jun 19 2025
Guide Sections
Guide Comments
Git has a lot of config values that your are able to set, from details of the user to the text editor used and beyond. I will not be listing all of these different options.
As a bare minimum you need to set:
- user.name - your user name as you want it to appear on commits.
- user.email - your email address that appears on commits. Note that anyone with access to the commits on a project will be able to view your email address used.
Config can be set at different scope levels.
Config Scopes
Config values can be set at 5 different hierarchical scopes:
- System :
--system
- Applies to every user and every repository on the entire system.
- On Linux based systems this is stored in
/etc/gitconfig
. - On Windows this is stored in
C:\ProgramData\Git\config
. - It requires admin/root privileges to edit.
- Global :
--global
- Applies to your user account, across all repositories you work on.
- On Linux based systems this is stored in
~/.gitconfig
. - On Windows this is stored in
%USERPROFILE%\.gitconfig
.
- Local :
--local
- Applies to a specific repository only.
- This is stored in
.git/config
file in the project.
- Worktree :
--worktree
- Applies only when using linked working trees - not common but included for completeness.
- This is stored in
.git/worktrees/<name>/config
file.
- Command line :
-c
- Temporarily overriding a setting just for a specific command.
So, for example, if you have the user.name Mike Smith
set at the global scope and at the local project level you have Dave Smith
, Git will use the local user.name of Dave Smith
. If user name isn't set at the project level then it will look up to the next level and use the global user.name of Mike Smith
.
If you were then to do a commit with the -c option then this would override both the local and global user.name, eg. :
Git would use the name Bobby Smith
just for that commit.
Listing and setting config values
List all config values at the global scope:
This will display an output something like this, listing all global config values set:
List all config values at the local scope, when inside the projects folder:
To set the user.name and user.email at the global scope:
Note you can also pass in --set
with the command, but it is implied if missing. It can add clarity when using in scripts to include it though.
To get the user.name at the global scope:
If more than 1 key is found then it outputs the last one it finds. You can pass in --all
to list all keys found.
If no scope is provided, Git looks through the hierarchy and returns the first match. Eg if the user.name is only set as global, it will check local, not find it, check global and then find a match and output it.
To remove a config setting completely:
This removes the user.name from the global config file.
To show which config file a specific config is stored:
Displays the file path of the config file and the value.
To list all config values setup on the machine:
To list all config values setup on the machine and the config file locations:

Complete config command options
For more information on all the different possible config values and config command options, which are not covered in this guide, please refer to this link.