Git 常见错误

2019-04-13  本文已影响0人  哎呦喂_e2d5

fatal:refusing to merge unrelated histories

出现原因

使用git pull origin master命令时,提示此错误,是因为远程仓库中已经存在代码记录了,并且那部分代码没有和本地仓库进行关联

解决方法

git pull origin master --allow-unrelated-histories

warning: LF will be replaced by CRLF

出现原因

在各操作系统下,文本文件所使用的换行符是不一样的。

解决方法

1.AutoCRLF

#提交时转换为LF,检出时转换为CRLF
git config --global core.autocrlf true

#提交时转换为LF,检出时不转换
git config --global core.autocrlf input

#提交检出均不转换 (较合适的解决方法)
git config --global core.autocrlf false

2.SafeCRLF

#拒绝提交包含混合换行符的文件 (较合适的解决方法)
git config --global core.safecrlf true

#允许提交包含混合换行符的文件
git config --global core.safecrlf false

#提交包含混合换行符的文件时给出警告
git config --global core.safecrlf warn
上一篇 下一篇

猜你喜欢

热点阅读