为什么 "git config -l" 输出 core.autocrlf 有两条不同的行?

Why are there two different lines with core.autocrlf output with "git config -l"?

我正在尝试设置 core.autocrlf=true。但是在执行 git config --global core.autocrlf true 之后 git config -l 的输出显示了这两行

core.autocrlf=false
... other settings ...
core.autocrlf=true

为什么会这样,如何确保 autocrlf 正确设置为 true

您可以通过 Git 2.8+ 了解更多信息:

git config -l --show-origin

这将使您更好地了解这些设置的来源。
本地配置覆盖覆盖系统设置的全局设置。

请参阅“Where do the settings in my Git configuration come from?”中的具体示例。

Xavi Montero points out to the Pro Book "Getting Started - First-Time Git Setup" 其中提到:

If you are using version 2.x or later of Git for Windows, there is also a system-level config file at

  • C:\Documents and Settings\All Users\Application Data\Git\config on Windows XP, and
  • in C:\ProgramData\Git\config on Windows Vista and newer.

This config file can only be changed by git config -f <file> as an admin.