1git-config-set(1) 2=============== 3 4NAME 5---- 6git-config-set - Set options in .git/config. 7 8 9SYNOPSIS 10-------- 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] 17 18DESCRIPTION 19----------- 20You can query/set/replace/unset options with this command. The name is 21actually the section and the key separated by a dot, and the value will be 22escaped. 23 24If you want to set/unset an option which can occor on multiple lines, you 25should provide a POSIX regex for the value. 26 27This command will fail if 28 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. 35 36 37OPTIONS 38------- 39 40--replace-all:: 41 Default behaviour is to replace at most one line. This replaces 42 all lines matching the key (and optionally the value_regex) 43 44--get:: 45 Get the value for a given key (optionally filtered by a regex 46 matching the value). 47 48--get-all:: 49 Like get, but does not fail if the number of values for the key 50 is not exactly one. 51 52--unset:: 53 Remove the line matching the key from .git/config. 54 55--unset-all:: 56 Remove all matching lines from .git/config. 57 58 59EXAMPLE 60------- 61 62Given a .git/config like this: 63 64 # 65 # This is the config file, and 66 # a '#' or ';' character indicates 67 # a comment 68 # 69 70 ; core variables 71 [core] 72 ; Don't trust file modes 73 filemode = false 74 75 ; Our diff algorithm 76 [diff] 77 external = "/usr/local/bin/gnu-diff -u" 78 renames = true 79 80 ; Proxy settings 81 [proxy] 82 command="ssh" for "ssh://kernel.org/" 83 command="proxy-command" for kernel.org 84 command="myprotocol-command" for "my://" 85 86you can set the filemode to true with 87 88------------ 89% git config-set core.filemode true 90------------ 91 92The hypothetic proxy command entries actually have a postfix to discern 93to what URL they apply. Here is how to change the entry for kernel.org 94to "ssh". 95 96------------ 97% git config-set proxy.command '"ssh" for kernel.org' 'for kernel.org$' 98------------ 99 100This makes sure that only the key/value pair for kernel.org is replaced. 101 102To delete the entry for renames, do 103 104------------ 105% git config-set --unset diff.renames 106------------ 107 108If you want to delete an entry for a multivar (like proxy.command above), 109you have to provide a regex matching the value of exactly one line. 110 111To query the value for a given key, do 112 113------------ 114% git config-set --get core.filemode 115------------ 116 117or 118 119------------ 120% git config-set core.filemode 121------------ 122 123or, to query a multivar: 124 125------------ 126% git config-set --get proxy.command "for kernel.org$" 127------------ 128 129If you want to know all the values for a multivar, do: 130 131------------ 132% git config-set --get-all proxy.command 133------------ 134 135If you like to live dangerous, you can replace *all* proxy.commands by a 136new one with 137 138------------ 139% git config-set --replace-all proxy.command ssh 140------------ 141 142 143Author 144------ 145Written by Johannes Schindelin <Johannes.Schindelin@gmx.de> 146 147Documentation 148-------------- 149Documentation by Johannes Schindelin. 150 151GIT 152--- 153Part of the gitlink:git[7] suite 154