Home > Blockchain >  What does --config-env=http.extraheader=env_var_http.extraheader mean when passed to git inside Azur
What does --config-env=http.extraheader=env_var_http.extraheader mean when passed to git inside Azur

Time:09-08

The full command like could be something like this:

git --config-env=http.extraheader=env_var_http.extraheader fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin

I have a feeling it has to do with authenticating git command to the git server, but I do not understand how does it work.

CodePudding user response:

This is an option of the git command:

--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> containing 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.

Here it sets the git configuration http.extraheader with the value of the environment variable named http.extraheader.*

As illustrated in microsoft/azure-pipelines-agent PR3949, it can be used to pass auth header.

  • Related