跑步时git status
我经常收到多个警告:
$ git status
warning: Untracked cache is disabled on this system.
warning: Untracked cache is disabled on this system.
warning: Untracked cache is disabled on this system.
warning: Untracked cache is disabled on this system.
warning: Untracked cache is disabled on this system.
warning: Untracked cache is disabled on this system.
warning: Untracked cache is disabled on this system.
warning: Untracked cache is disabled on this system.
我已将其添加到我的 .gitconfig 中:
[core]
untrackedCache = true
甚至尝试跑步git update-index --untracked-cache
。但这没有帮助。
在 Ubuntu Xenial 上使用 git v2.7.4。
是什么导致了这些警告以及如何消除它们(没有管道错误/dev/null
)?
(VonC 的问题是一个关键线索:未跟踪的缓存要求工作树路径与存储在索引中的路径匹配。此外,系统名称来自uname
's utsname
字段,保存在那里并且也必须匹配;这会影响通过网络文件系统(例如 NFS 或 SMB)管理的文件。)
由于未跟踪的缓存在您的系统上被禁用并会导致警告,因此您可能不希望尝试en能够做到。换句话说,离开core.untrackedCache
取消设置,或将其设置为false
。然而,core.untrackedCache
是 Git 2.8.0 版本中的新设置;如果你的 Git 是 2.7.4,那么你就没有它。
Running git update-index --untracked-cache
强制启用该设置(然后生成所有这些错误消息)。您可以使用git update-index --no-untracked-cache
强行关闭它。唯一不好的影响就是git status
当禁用未跟踪的缓存时,运行速度可能会变慢(可能会明显变慢)。
请注意,从 2.8.0 开始,Git 建议运行git update-index --test-untracked-cache
在启用未跟踪的缓存之前(使用--untracked-cache
or core.untrackedCache = true
)。还要注意,如果这是core
设置被设置为true
or false
, the core.untrackedCache
只需复制设置to索引更新时的索引(带有git update-index
)。实际上是索引的设置控制了一切。使用默认值(未设置)或将其设置为keep
告诉 Git 保留 untracked-cache 设置。
还可以设置环境变量GIT_DISABLE_UNTRACKED_CACHE
(任何值)以禁用未跟踪缓存的使用,无论索引中的当前设置如何。 (此代码似乎也在 2.7.4 中。)这将绕过警告,并且不使用未跟踪的缓存,无论索引中的设置如何。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)