I have found through this answer that Git 2.31 introduced the environment variable override system (GIT_CONFIG_KEY_x
, GIT_CONFIG_VALUE_x
) which is now documented here. This is a very useful feature to me.
My use-case has a process (ansible galaxy in this case) that is running git commands behind the scenes. I would like to override some of that git config only for that action, but I can't use git -c
command line arg since I'm not running git
directly.
Using the described env vars works perfectly for this use-case as long as I have git 2.31 or above. It works great on my workstation that has a newer version of git, but my production systems are running Ubuntu 20.04 (focal) currently. The Apt repos only host git version 2.25 so I can't get >= 2.33 without doing a custom install without Apt, which I would really like to avoid.
So my question to this community: Given my specific use-case, is there is any alternate way to override config without feeding it a whole config file with GIT_CONFIG=config.conf
with a version of git < 2.31?
Side note: the git config item I'm specifically trying to override is "advice.detachedHead=false"