在Windows中覆盖.gitattributes text = auto

这非常不直观:

C:\python-tdl\examples\termbox>git config core.autocrlf false C:\python-tdl\examples\termbox>git commit termbox.py warning: LF will be replaced by CRLF in examples/termbox/termbox.py. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in examples/termbox/termbox.py. The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in examples/termbox/termbox.py. The file will have its original line endings in your working directory. Aborting commit due to empty commit message. 

根据core.autocrlf=false各种媒体, core.autocrlf=false应该换行。

在项目根目录中,我发现了.gitattributes与行:

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

如果我评论它,警告消失。 这个问题 – 我怎么能自动覆盖这个.gitattibutes设置?

Solutions Collecting From Web of "在Windows中覆盖.gitattributes text = auto"

.gitattributes覆盖所有的配置设置,所以它确实不能被覆盖。 可以这么说,这就是“覆盖”。 虽然您可以简单地删除该行,但如果其他开发人员的机器上有core.autocrlf=true ,则会导致行为不一致。 所以最好的办法是把下面一行加到.gitattributes* -text .gitattributes 。 这将禁用所有文件的CRLF处理。