git上传代码报错-The file will have its original line endings in your working directory

Posted 头名字W

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git上传代码报错-The file will have its original line endings in your working directory相关的知识,希望对你有一定的参考价值。

原因是因为文件中换行符的差别导致的。

这里需要知道CRLF和LF的区别:

windows下的换行符是CRLF而Unix的换行符格式是LF。git默认支持LF。

上面的报错的意思是会把CRLF(也就是回车换行)转换成Unix格式(LF),这些是转换文件格式的警告,不影响使用。

一般commit代码时git会把CRLF转LF,pull代码时LF换CRLF。

解决方案:

git rm -r --cached .
git config core.autocrlf false
 

然后重新上传代码即可。
 

以上是关于git上传代码报错-The file will have its original line endings in your working directory的主要内容,如果未能解决你的问题,请参考以下文章

[git] -- warning: LF will be replaced by CRLF in app/app.iml. The file will have its original line e

git出现“The file will have its original line endings in your working directory”错误

Centos7系统安装软件提示“git is not in the sudoers file. This incident will be reported“

解决linux下sudo更改文件权限报错xxxis not in the sudoers file. This incident will be reported.

git bash提交代码过程 以及 git pull报错 your local changes to the following files would be overwritten by merge

git 常见冲突—— git pull遇到报错Your local changes to the following files would be overwritten by merge