【问题标题】:possible to config Git line-endings specific to repo?可以配置特定于 repo 的 Git 行尾吗?
【发布时间】:2014-07-30 23:33:29
【问题描述】:

我正在 Windows 和 Mac 上针对 GitHub 上的一个 repo 工作。

在 GitHub 上,我希望行尾为 LF。

在 Mac OS X 上,我希望行尾为 LF。

在 Windows 上,我希望行尾为 CRLF——除了我想要 LF 的特定 repo。

这可能吗?

【问题讨论】:

    标签: git github newline line-endings lf


    【解决方案1】:

    我建议你在 Windows 上运行

    git config --global core.autocrlf true
    

    它将自动转换到 Windows 行尾

    然后在不需要转换的特定存储库中,您应该运行

    git config core.autocrlf false
    

    你会注意到 git config 有一个 --global 属性来修改你的 ~/.gitconfig (或 C:\Users\.gitconfig )文件。如果没有此标志,这些设置将添加到您的存储库中。

    请参阅git reference manual 了解更多说明

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-06
      • 2020-12-28
      • 1970-01-01
      • 2017-11-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多