Git 将图像中的 CRLF 转换为 LF
Git converting CRLF to LF in images
每次我向我的项目添加新图像时,Git 将 CRLF 转换为 LF。如果文件来自 windows 就没问题,但它不是,我在 Debian 上!
然后我从远程服务器上的 "pull" 获取的文件已损坏 =/
使用 .gitattributes
文件,在其中放置:
*.png binary
但很奇怪,默认情况下不是这样。
也许您使用了其他一些不常见的图像格式?
在我的例子中,有一个内容为 * text=auto eol=lf
的 .gitattribute 文件。添加edi9999的answer(*.png binary)后,完美。
我的问题是 .gitattribute
文件包含 * text eol=lf
行,该行将 所有 文件转换为文本,包括图像。将行更改为 * text=auto eol=lf
时,git 会自动检测文件是否为二进制文件并且不会触及其行尾。
每次我向我的项目添加新图像时,Git 将 CRLF 转换为 LF。如果文件来自 windows 就没问题,但它不是,我在 Debian 上! 然后我从远程服务器上的 "pull" 获取的文件已损坏 =/
使用 .gitattributes
文件,在其中放置:
*.png binary
但很奇怪,默认情况下不是这样。
也许您使用了其他一些不常见的图像格式?
在我的例子中,有一个内容为 * text=auto eol=lf
的 .gitattribute 文件。添加edi9999的answer(*.png binary)后,完美。
我的问题是 .gitattribute
文件包含 * text eol=lf
行,该行将 所有 文件转换为文本,包括图像。将行更改为 * text=auto eol=lf
时,git 会自动检测文件是否为二进制文件并且不会触及其行尾。