记录Git报错
First Post:
Last Update:
Last Update:
一、warning: LF will be replaced by CRLF in node/node_project.The file will have its original line endings in your working directory
1、报错警告:
git add添加文件到暂存区时警告
1 | warning: LF will be replaced by CRLF in node/node-project. |
2、原因:
这是因为在windows和unix下的换行符不一样,git bush是unix风格设计的,虽然git默认会自动转换,但是有时会出问题
3、解决办法:
禁止自动转换
git config –global core.autocrlf false
1
二、 ! [rejected] main -> main (fetch first) error: failed to push some refs to ‘https://github.com/xxxxxx’
1、情景再现:
git push origin main 提交代码到远程仓库时报错
1 | ! [rejected] main -> main (fetch first) |
2、原因:
远程仓库中的代码比本地仓库中的新(存在本地仓库没有的文件)
3、解决办法:
将远程仓库中的代码合并到本地即可
1 | git pull --rebase origin main |
打赏
支付宝 | Alipay


微信 | WeChat

