I work on build systems which need to check code out of source control systems like git. I need to do this in a way in which there are not outside influences and a user's $HOME/.gitconfig file can contain things we don't want. I therefore need a way to disable it. Looking through the manuals/code, it suggests I should be able to do: GIT_CONFIG=/dev/null git XXX and all should work happily. It doesn't though. As an example, with a ~/.gitconfig, "GIT_CONFIG=/dev/null git fetch --all" is clearly accessing the file in ~ and then acting upon it. I've searched through the code and whilst config_exclusive_filename appears to be the magic variable that should get set when I set GIT_CONFIG in the environment, nothing ever sets it apart from within a git-config command. The following patch sets the variable from the environment initially and should do what the code intends if I read understand it correctly. Its not ideal for my use case as I actually want the repo_config and only the repo config to be used but I can live with setting GIT_CONFIG to point at it. Alternative ideas welcome, I've considered changing $HOME but that seems a little too ugly and likely to cause other problems. Signed-off-by: Richard Purdie <richard.purdie@xxxxxxxxxxxxxxxxxxx> diff --git a/config.c b/config.c index d06fb19..19e7565 100644 --- a/config.c +++ b/config.c @@ -860,6 +860,8 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config) int ret = 0, found = 0; const char *home = NULL; + config_exclusive_filename = getenv(CONFIG_ENVIRONMENT); + /* Setting $GIT_CONFIG makes git read _only_ the given config file. */ if (config_exclusive_filename) return git_config_from_file(fn, config_exclusive_filename, data); -- Linux Foundation http://www.yoctoproject.org/ -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html