repository: Allow fetching via in-memory remotes
When providing remote params for FetchRemote()
, then we currently
create a temporary remote just to remove it after the call again. This
is expensive given that removal of the remote may involve pruning all
references which have been created as part of the remote's default fetch
refspec. Furthermore, we also inject configuration into the fetch by
calling the Ruby sidecar in order to put HTTP authorization headers into
the gitconfig in order to avoid leaking credentials via the command line
of git config
.
Starting with git v2.31.0, we now have a better mechanism available to
do this without leaking any sensitive information with the
GIT_CONFIG_KEY
and GIT_CONFIG_VALUE
environment variables. In
contrast to the command line, using environment variables avoid the
issue of leaks through the command line as environment variables are by
default not visible to any user but the owner.
In case this mechanism is supported, this commit thus introduces a new way of fetching remotes with an in-memory remote constructed by injecting required environment variables into the resulting process.
Part of #1773 (closed)