ana*_*nik 6 windows git gitattributes core.autocrlf
这是非常不直观的:
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.
Run Code Online (Sandbox Code Playgroud)
根据各种媒体,core.autocrlf=false根本不应该有换行转换。
在项目根目录中,我发现.gitattributes了以下内容:
# Auto detect text files and perform LF normalization
* text=auto
Run Code Online (Sandbox Code Playgroud)
如果我评论它,警告就会消失。问题 - 如何.gitattibutes自动覆盖此设置?
.gitattributes覆盖所有配置设置,所以它真的不能被覆盖;可以这么说,它是“覆盖程序”。虽然您可以简单地删除该行,但如果其他开发人员的计算机上有core.autocrlf=true. 所以最好的办法是将以下行添加到.gitattributes: * -text。这将禁用所有文件的 CRLF 处理。