git-强制lf行结尾不捕获二进制文件

时间:2018-11-26 11:57:29

标签: windows git line-endings

根据Force LF line endings using .gitattributes without losing automatic text/binary inference?,当我将.gitattributes设置为仅包含

* text=auto
* text eol=lf

然后将所有文本文件转换为LF行结尾,并且二进制文件应保持不变-这就是我想要的。但是不知何故,此处无法正确检测二进制文件。在Windows下查看git bash控制台的输出:

$ git add .
warning: CRLF will be replaced by LF in clip2txt.exe.
The file will have its original line endings in your working directory
warning: CRLF will be replaced by LF in raw.png.
The file will have its original line endings in your working directory
warning: CRLF will be replaced by LF in test.
The file will have its original line endings in your working directory

我本来希望raw.png和clip2txt.exe是二进制文件而被忽略。文件测试将正确转换,就可以了。

我在这里错过了什么吗? 谢谢, br亚历克斯

1 个答案:

答案 0 :(得分:0)

如果有人正在调查,我将其标记为已回答:

解决方案是将.gitattributes设置为

* text=auto eol=lf

感谢@phd