6 git-config-set - Set options in .git/config.
11 'git-config-set' name [value [value_regex]]
12 'git-config-set' --replace-all name [value [value_regex]]
13 'git-config-set' --get name [value_regex]
14 'git-config-set' --get-all name [value_regex]
15 'git-config-set' --unset name [value_regex]
16 'git-config-set' --unset-all name [value_regex]
20 You can query/set/replace/unset options with this command. The name is
21 actually the section and the key separated by a dot, and the value will be
24 If you want to set/unset an option which can occor on multiple lines, you
25 should provide a POSIX regex for the value.
27 This command will fail if
29 . .git/config is invalid,
30 . .git/config can not be written to,
31 . no section was provided,
32 . the section or key is invalid,
33 . you try to unset an option which does not exist, or
34 . you try to unset/set an option for which multiple lines match.
41 Default behaviour is to replace at most one line. This replaces
42 all lines matching the key (and optionally the value_regex)
45 Get the value for a given key (optionally filtered by a regex
49 Like get, but does not fail if the number of values for the key
53 Remove the line matching the key from .git/config.
56 Remove all matching lines from .git/config.
62 Given a .git/config like this:
65 # This is the config file, and
66 # a '#' or ';' character indicates
72 ; Don't trust file modes
77 external = "/usr/local/bin/gnu-diff -u"
82 command="ssh" for "ssh://kernel.org/"
83 command="proxy-command" for kernel.org
84 command="myprotocol-command" for "my://"
86 you can set the filemode to true with
89 % git config-set core.filemode true
92 The hypothetic proxy command entries actually have a postfix to discern
93 to what URL they apply. Here is how to change the entry for kernel.org
97 % git config-set proxy.command '"ssh" for kernel.org' 'for kernel.org$'
100 This makes sure that only the key/value pair for kernel.org is replaced.
102 To delete the entry for renames, do
105 % git config-set --unset diff.renames
108 If you want to delete an entry for a multivar (like proxy.command above),
109 you have to provide a regex matching the value of exactly one line.
111 To query the value for a given key, do
114 % git config-set --get core.filemode
120 % git config-set core.filemode
123 or, to query a multivar:
126 % git config-set --get proxy.command "for kernel.org$"
129 If you want to know all the values for a multivar, do:
132 % git config-set --get-all proxy.command
135 If you like to live dangerous, you can replace *all* proxy.commands by a
139 % git config-set --replace-all proxy.command ssh
145 Written by Johannes Schindelin <Johannes.Schindelin@gmx.de>
149 Documentation by Johannes Schindelin.
153 Part of the gitlink:git[7] suite