Git:Config
lastmod 2026-01-02created 2014-02-1625 edits
Get and set repository or global options.
SYNOPSIS
git config [<file-option>] [type] [-z|--null] name [value [value_regex]]
git config [<file-option>] [type] --add name value
git config [<file-option>] [type] --replace-all name value [value_regex]
git config [<file-option>] [type] [-z|--null] --get name [value_regex]
git config [<file-option>] [type] [-z|--null] --get-all name [value_regex]
git config [<file-option>] [type] [-z|--null] --get-regexp name_regex [value_regex]
git config [<file-option>] --unset name [value_regex]
git config [<file-option>] --unset-all name [value_regex]
git config [<file-option>] --rename-section old_name new_name
git config [<file-option>] --remove-section name
git config [<file-option>] [-z|--null] -l | --list
git config [<file-option>] --get-color name [default]
git config [<file-option>] --get-colorbool name [stdout-is-tty]
git config [<file-option>] -e | --edit
Default gitconfig
The contents of etc/gitconfig included with a fresh Git installation (on Windows) are as follows.
[core]
symlinks = false
autocrlf = false
[color]
diff = auto
status = auto
branch = auto
interactive = true
[pack]
packSizeLimit = 2g
[help]
format = html
[http]
sslCAinfo = /bin/curl-ca-bundle.crt
[sendemail]
smtpserver = /bin/msmtp.exe
[diff "astextplain"]
textconv = astextplain
[rebase]
autosquash = true
Config file location
The config file locations are listed below.
-
--global - use global config file
-
--system - use system config file
-
--local - use repository config file
-
-f, --file <file> - use given config file
Setting check
Enter the following to view the configured settings.
Save password
To save credentials, enter the following inside the repository.
Save globally:
Setting up name and e-mail address
To set the Git user name and e-mail address:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Applying user information temporarily
Temporarily changes the user name and e-mail address.
Installation Options line endings
Also, for users of Unix/Mac:
For Windows users:
Console UI Color setting
To color the text printed to the console:
Alias setting
- Creating Git Aliases
- [Recommended] Setting up convenient git aliases 1
To assign a long command to a single alias:
push.default
The push.default property is an option for the default behavior when pushing. Usage:
- matching: compares all local branch names with the remote and pushes every branch with a matching name.
- simple: pushes only the branch you are currently working on.
SSL certificate rejected
An SSL certificate problem may produce the following message.
In this case, you can SKIP SSL certificate verification as follows.
Http Post buffer size
- Git, fatal: The remote end hung up unexpectedly
- Git fails when pushing commit to github
- Gitlab error "fatal: The remote end hung up unexpectedly"
The following error may occur.
This is a problem when the postBuffer is smaller than the source file size. Set the HTTP POST request buffer size.
i18n setting
UTF-8 setting (applies to Window environments)
Proxy setting
Either use environment variables such as http_proxy, https_proxy, all_proxy,
or, to specify it separately, add the http.proxy setting:
In addition, most sites use HTTPS, and certificate verification may fail when going through a proxy.
Add the http.sslVerify=false setting to bypass certificate verification:
Internal Git repositories are usually located inside the proxy network, so you set up a proxy exception for them.
Git lets you apply settings to a specific URL using http.<url>.*.
For example, if https://code.oofbird.me is the Git repository, set the proxy to empty as follows.
To save it directly in the .gitconfig file:
Remove credentials
Retype:
Print settings along with their file locations
Include another gitconfig file
Git (1.7.10+) now supports this syntax in .gitconfig:
See also
Favorite site
- [Recommended] Popular Git config options | GeekNews
- How do Git core developers configure and use Git? | GeekNews