如何告诉git忽略全局配置 [英] How to tell git to ignore global config

查看:80
本文介绍了如何告诉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 的环境变量(类似于

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.

推荐答案

我需要它,因为我的标准git设置(尤其是commit.gpgsign true)会干扰使用git的测试套件.

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

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

GIT_CONFIG_NOSYSTEM

是否跳过从系统范围的$(prefix)/etc/gitconfig文件中读取设置.该环境变量可以与$ HOME和$ XDG_CONFIG_HOME为挑剔的脚本创建可预测的环境,或者您可以临时设置它,以避免在等待时使用有问题的/etc/gitconfig文件给有足够权限修复它的人.

Whether to skip reading settings from the system-wide $(prefix)/etc/gitconfig file. This environment variable can be used along with $HOME and $XDG_CONFIG_HOME to create a predictable environment for a picky script, or you can set it temporarily to avoid using a buggy /etc/gitconfig file while waiting for someone with sufficient permissions to fix it.

设置 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忽略全局配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆