aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/git.txt
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2021-01-12 13:26:45 +0100
committerJunio C Hamano <gitster@pobox.com>2021-01-12 12:03:18 -0800
commitce81b1da230cf04e231ce337c2946c0671ffb303 (patch)
tree1da56ff0ae9cd73277adc220bad64122482fc69c /Documentation/git.txt
parentb0812b6ac0776b6e43e8483d5579ffd11d5c5f42 (diff)
downloadgit-ce81b1da230cf04e231ce337c2946c0671ffb303.tar.gz
config: add new way to pass config via `--config-env`
While it's already possible to pass runtime configuration via `git -c <key>=<value>`, it may be undesirable to use when the value contains sensitive information. E.g. if one wants to set `http.extraHeader` to contain an authentication token, doing so via `-c` would trivially leak those credentials via e.g. ps(1), which typically also shows command arguments. To enable this usecase without leaking credentials, this commit introduces a new switch `--config-env=<key>=<envvar>`. Instead of directly passing a value for the given key, it instead allows the user to specify the name of an environment variable. The value of that variable will then be used as value of the key. Co-authored-by: Jeff King <peff@peff.net> Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git.txt')
-rw-r--r--Documentation/git.txt24
1 files changed, 23 insertions, 1 deletions
diff --git a/Documentation/git.txt b/Documentation/git.txt
index c463b937a8..3b0f87a71b 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -13,7 +13,7 @@ SYNOPSIS
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|-P|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
- [--super-prefix=<path>]
+ [--super-prefix=<path>] [--config-env <name>=<envvar>]
<command> [<args>]
DESCRIPTION
@@ -80,6 +80,28 @@ config file). Including the equals but with an empty value (like `git -c
foo.bar= ...`) sets `foo.bar` to the empty string which `git config
--type=bool` will convert to `false`.
+--config-env=<name>=<envvar>::
+ Like `-c <name>=<value>`, give configuration variable
+ '<name>' a value, where <envvar> is the name of an
+ environment variable from which to retrieve the value. Unlike
+ `-c` there is no shortcut for directly setting the value to an
+ empty string, instead the environment variable itself must be
+ set to the empty string. It is an error if the `<envvar>` does not exist
+ in the environment. `<envvar>` may not contain an equals sign
+ to avoid ambiguity with `<name>`s which contain one.
++
+This is useful for cases where you want to pass transitory
+configuration options to git, but are doing so on OS's where
+other processes might be able to read your cmdline
+(e.g. `/proc/self/cmdline`), but not your environ
+(e.g. `/proc/self/environ`). That behavior is the default on
+Linux, but may not be on your system.
++
+Note that this might add security for variables such as
+`http.extraHeader` where the sensitive information is part of
+the value, but not e.g. `url.<base>.insteadOf` where the
+sensitive information can be part of the key.
+
--exec-path[=<path>]::
Path to wherever your core Git programs are installed.
This can also be controlled by setting the GIT_EXEC_PATH