【问题标题】:EOL Issue with GIT on .cmd-file on Windows 8.1Windows 8.1 上 .cmd 文件上的 GIT 出现 EOL 问题
【发布时间】:2017-11-08 08:16:36
【问题描述】:

我在 unstaged 文件中有一个 maven 文件 mvnw.cmd,但没有真正的修改。在我看来,它与 EOL 有关,因为每一行都被标记为删除和添加。

我已经尝试从 GIT 中删除并再次取出它。我试图把它藏起来,但它仍然是未暂存的文件。

.gitattributes 文件:

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

# Make sure that the line ending style ist set to Linux for shell scripts
*.sh        eol=lf


# Make sure that the line ending style ist set to Windows for bat scripts
*.bat       eol=crlf
*.cmd       eol=crlf

提前谢谢你。

【问题讨论】:

  • 好的,但是该文件在存储库中有什么样的行尾?使用hexdump 或一些将显示行尾或十六进制的编辑器。它可能在存储库中有不正确的行尾,除了您的gitattributes 之外还需要更正。

标签: git batch-file eol gitattributes


【解决方案1】:

不明白为什么,但是在 GIT 本身更新之后一切都很好。

Git 老是 2.9.0 git new 是2.15.0

问题消失了。

【讨论】:

    【解决方案2】:

    这可能是由于 Git 如何根据 core.autocrlf 的值转换行尾。 查看此问题以获取解释: https://stackoverflow.com/a/20653073/4522186

    【讨论】:

      猜你喜欢
      • 2021-04-05
      • 2018-09-02
      • 1970-01-01
      • 2015-08-26
      • 2019-02-07
      • 2019-02-19
      • 1970-01-01
      • 1970-01-01
      • 2019-02-16
      相关资源
      最近更新 更多