TIL GIT_CONFIG_PARAMETERS
An undocumented feature of git is the single environment variable GIT_CONFIG_PARAMETERS
. It allows you to set the git config with a single variable. The only documented option like this is GIT_CONFIG_COUNT
, but that one is a bit more unwiedly since it requires 2 environment variables per config option.
GIT_CONFIG_PARAMETERS="'user.name=CI' 'user.email=ci@git'"
Searching the git history it has been supported for 15 years but I can't find any commits documenting it ever. When you read the initial commit message it may have only been intended to be used by git calling itself in subprocesses. However, I find a few references to it outside of git (eg buildkite forum references) and feature requests in libgit2 to support it/etc.
https://github.com/git/git/commit/2b64fc894dada0916558fd0bfd19c50631f978cb