Search notes:

git config

Get or set options.
git config --global user.email "…"
git config --global user.name  "René Nyffenegger"

git config --global --get   user.email

git config --global --unset user.email
When modifing option values, the default config file where the new values are written to is the one in the local repository. This can be changed with --global or --system.

--list: show all options that are set in config files and their values

git config --list
In order to also show in which config file a setting was set, combine --list with --show-origin:
git config --list --show-origin

Show origin and used value for a given option

Apparently, the following command does not show all origins where an option value is set but only the origin which set the value:
git config --show-origin core.autocrl

--global, --user, --local, --worktree, --file

git config --global …
git config --user   …
git config --local  …
--user for any «global» setting that is specific to a user. These options are stored in $HOME/.gitconfig
--local for settings specific to a checked out repository. These options are stored in the config file below the repository's .git directory.
--worktree read from .git/config.worktree if the option extensions.worktreeConfig is present (and true?). If this value is not present, --worktree behaves like --local.
--file (or -f) specifies the config file being written to.

dot in config names

Config names contain at least one dot, for example credential.useHttpPath. The value before the first dot indicates a section in the config file so that credential.useHttpPath = true is stored in a config file like so:
[credential]
        httpusepath = true

Show values of options that match a regular expression

The --get-regexp option can be used to show options whose name match a regular expression.
The following example works in PowerShell, I am not sure for other shells because of their escaping rules:
git config  --get-regexp ^core\.
Combine with --show-origin:
git config --show-origin --get-regexp mail

Removing values from a config file

git config --unset <option-name>

error: cannot overwrite multiple values with a single value

The following command assigns or overwrites the value aValue in the config's section sect:
git config  sect.opt    aValue
Github repository about-git, path: /commands/config/cannot-overwrite-multiple-values-with-a-single-value/1.ps1
Changing this value is possible without problems:
git config  sect.opt    anotherValue 
Github repository about-git, path: /commands/config/cannot-overwrite-multiple-values-with-a-single-value/2.ps1
When (mistakenly) using the equal sign to assign a value, no warning or error is displayed:
git config  sect.opt =  yetAnotherValue
Github repository about-git, path: /commands/config/cannot-overwrite-multiple-values-with-a-single-value/3.ps1
However, when displaying the .git/config file, …
cat .git/config
Github repository about-git, path: /commands/config/cannot-overwrite-multiple-values-with-a-single-value/cat-config.ps1
… the relevant portion of the config file is.
[sect]
        opt = anotherValue
        opt = =
The git config command assigned the value = to the option name opt!
Trying to change the value of opt now results in the error message cannot overwrite multiple values with a single value:
git config  sect.opt    nono
Github repository about-git, path: /commands/config/cannot-overwrite-multiple-values-with-a-single-value/4.ps1

See also

Commands have the common option -c option=value which allows to override an option value when executing a git command.
git commands

Index