【问题标题】:Git clones repository with CRLF even though I have core.autocrlf=false即使我有 core.autocrlf=false,Git 也会使用 CRLF 克隆存储库
【发布时间】:2014-11-13 13:16:54
【问题描述】:

当我在 Windows 上使用 msysgit 克隆使用 LF 行结尾的存储库时,即使我的 core.autocrlf 设置为 false,检出的文件也以某种方式具有 CRLF 行结尾。这是为什么呢?

例子:

> git config core.autocrlf
false

> git clone https://github.com/wp-cli/wp-cli.git wp-cli

检出的文件有 CRLF 行结尾,即使它们在存储库本身中有 LF。

【问题讨论】:

    标签: git core.autocrlf


    【解决方案1】:

    项目中有一个.gitattributes文件

    # Auto detect text files and perform EOL normalization
    * text=auto
    

    这比 core.autocrlf 具有更高的优先级。

    http://git-scm.com/docs/gitattributes

    【讨论】:

    • 我们几乎同时发帖:)
    【解决方案2】:

    啊哈,.gitattributes 也有影响,there is such file 在 wp-cli 存储库中。

    【讨论】:

      猜你喜欢
      • 2017-08-07
      • 1970-01-01
      • 2018-06-20
      • 1970-01-01
      • 2016-08-15
      • 1970-01-01
      • 1970-01-01
      • 2018-11-23
      • 2017-03-04
      相关资源
      最近更新 更多