如何告诉git忽略全局配置

如何告诉git忽略全局配置

本文介绍了如何告诉git忽略全局配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Git文档讨论默认设置全局git配置文件位置( $ XDG_CONFIG_HOME/git/config 〜/.gitconfig ),但没有提供一种方法来告诉git命令忽略该文件.

The Git docs talk about the default global git config file locations ($XDG_CONFIG_HOME/git/config or ~/.gitconfig), but don't offer a way to tell a git command to ignore that file.

我正在寻找一个可能称为 $ GIT_CONFIG_NOGLOBAL 的环境变量(类似于 $ GIT_CONFIG_NOSYSTEM ),或传递给git命令的标志(例如-ignore-global-config ).我需要它是因为我的标准git设置(尤其是 commit.gpgsign true )会干扰使用git的测试套件.

I'm looking for an environment variable, maybe called $GIT_CONFIG_NOGLOBAL (similar to $GIT_CONFIG_NOSYSTEM), or a flag to pass to git commands (for example --ignore-global-config). I need it because my standard git settings (especially commit.gpgsign true) interfere with test suites that use git.

如果目前无法实现,我可以在他们的问题跟踪器上提出问题.

If it's not currently possible I can raise an issue on their issue tracker.

推荐答案

我将其称为测试套件中的错误.应该将它们设置为忽略外部配置.我建议将此报告给测试套件作者.他们会做与您相同的事情:

I'd call that a bug in the test suites. They should be set up to ignore outside configs. I'd suggest reporting this to the test suite authors. They'd do the same thing you'd do:

设置 GIT_CONFIG_NOSYSTEM ,未设置 XDG_CONFIG_HOME ,更改 $ HOME .

@Pockets评论了并带有 Git测试套件的链接您可以在其中看到他们为确保Git被隔离所做的许多事情.

@Pockets commented with a link to the Git test suite where you can see all the many things they do to ensure Git is isolated.

这篇关于如何告诉git忽略全局配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 02:40