warning: LF will be replaced by CRLF in
程序员文章站
2022-05-03 16:01:10
...
warning: LF will be replaced by CRLF in
使用git add 命令的时候,有时候会出现一个警告 warning: LF will be replaced by CRLF in ******(具体的一个文件),一般不用在意这个warning,但了解一下怎么肥事业不是啥坏事
LF和CRLF
LF和CRLF其实都是换行符,但是不同的是,LF是linux和Unix系统的换行符,CRLF是window 系统的换行符
分析
从上面可以看出,这是跨平台操作带来的问题, git为了解决这个问题,提供了一个”换行符自动转换“的功能,并且这个功能默认处于”自动模式“即开启状态
换行符自动转换会自动把代码里 与当前操作系统不相同的换行符 转换成当前系统的换行方式(即LF和CRLF 之间的转换),这样一来,提交代码的时候,即使没有修改过某个文件,也被git认你修改过了,从而提示"LF will be replaced by CRLF in *****"
处理
这并不是什么大的影响,如果不想看到可以尝试如下方式解决
git config core.autocrlf false (仅对当前git仓库有效)
git config --global core.autocrlf false (全局有效)
上一篇: latex常见错误!missing $ inserted.和! File ended while scanning use of \@[email protected]
下一篇: max file descriptors [4096] for elasticsearch process is too low
推荐阅读
-
Android Studio完美解决 you are about to commit crlf line separators,warning: CRLF will be replaced by LF
-
【Hexo】Spawn failed fatal: LF would be replaced by CRLF
-
git提示CRLF will be replaced by LF问题及解决
-
CR、LF、CRLF 都是什么鬼?
-
[Intern][2019.03.21]LF, CR, CRLF and LFCR(?)
-
【Debug】WARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with '..
-
git add时遇到的warning: LF will be replaced by CRLF in问题
-
warning: LF will be replaced by CRLF in
-
已正确替换为implementation 却仍然报错:Warning:Configuration 'compile' is obsolete and has been replaced with 'i
-
Android Studio完美解决 you are about to commit crlf line separators,warning: CRLF will be replaced by LF