Home Explore Blog CI



git

1st chunk of `Documentation/git-config.adoc`
a689f140516f2c50159e70fd68de9ae37c788aac8bfe4c0b0000000100000fa3
git-config(1)
=============

NAME
----
git-config - Get and set repository or global options


SYNOPSIS
--------
[verse]
'git config list' [<file-option>] [<display-option>] [--includes]
'git config get' [<file-option>] [<display-option>] [--includes] [--all] [--regexp] [--value=<value>] [--fixed-value] [--default=<default>] <name>
'git config set' [<file-option>] [--type=<type>] [--all] [--value=<value>] [--fixed-value] <name> <value>
'git config unset' [<file-option>] [--all] [--value=<value>] [--fixed-value] <name>
'git config rename-section' [<file-option>] <old-name> <new-name>
'git config remove-section' [<file-option>] <name>
'git config edit' [<file-option>]
'git config' [<file-option>] --get-colorbool <name> [<stdout-is-tty>]

DESCRIPTION
-----------
You can query/set/replace/unset options with this command. The name is
actually the section and the key separated by a dot, and the value will be
escaped.

Multiple lines can be added to an option by using the `--append` option.
If you want to update or unset an option which can occur on multiple
lines, a `value-pattern` (which is an extended regular expression,
unless the `--fixed-value` option is given) needs to be given.  Only the
existing values that match the pattern are updated or unset.  If
you want to handle the lines that do *not* match the pattern, just
prepend a single exclamation mark in front (see also <<EXAMPLES>>),
but note that this only works when the `--fixed-value` option is not
in use.

The `--type=<type>` option instructs 'git config' to ensure that incoming and
outgoing values are canonicalize-able under the given <type>.  If no
`--type=<type>` is given, no canonicalization will be performed. Callers may
unset an existing `--type` specifier with `--no-type`.

When reading, the values are read from the system, global and
repository local configuration files by default, and options
`--system`, `--global`, `--local`, `--worktree` and
`--file <filename>` can be used to tell the command to read from only
that location (see <<FILES>>).

When writing, the new value is written to the repository local
configuration file by default, and options `--system`, `--global`,
`--worktree`, `--file <filename>` can be used to tell the command to
write to that location (you can say `--local` but that is the
default).

This command will fail with non-zero status upon error.  Some exit
codes are:

- The section or key is invalid (ret=1),
- no section or name was provided (ret=2),
- the config file is invalid (ret=3),
- the config file cannot be written (ret=4),
- you try to unset an option which does not exist (ret=5),
- you try to unset/set an option for which multiple lines match (ret=5), or
- you try to use an invalid regexp (ret=6).

On success, the command returns the exit code 0.

A list of all available configuration variables can be obtained using the
`git help --config` command.

COMMANDS
--------

list::
	List all variables set in config file, along with their values.

get::
	Emits the value of the specified key. If key is present multiple times
	in the configuration, emits the last value. If `--all` is specified,
	emits all values associated with key. Returns error code 1 if key is
	not present.

set::
	Set value for one or more config options. By default, this command
	refuses to write multi-valued config options. Passing `--all` will
	replace all multi-valued config options with the new value, whereas
	`--value=` will replace all config options whose values match the given
	pattern.

unset::
	Unset value for one or more config options. By default, this command
	refuses to unset multi-valued keys. Passing `--all` will unset all
	multi-valued config options, whereas `--value` will unset all config
	options whose values match the given pattern.

rename-section::
	Rename the given section to a new name.

remove-section::
	Remove the given section from the configuration file.

edit::
	Opens an editor to modify the specified config file; either
	`--system`, `--global`,

Title: Git Config Command
Summary
The git-config command is used to get and set repository or global options, allowing users to query, set, replace, and unset configuration options, with various commands and options available for different use cases.