Git报错 git pull时报错:fatal: refusing to merge unrelated histories
分类:
文章
•
2023-12-19 11:15:16
问题描述:
原因分析:
-
fatal: refusing to merge unrelated histories
(拒绝合并不相关的历史)
- 出现这个问题的最主要原因还是在于本地仓库和远程仓库实际上是独立的两个仓库。假如我之前是直接clone的方式在本地建立起远程github仓库的克隆本地仓库就不会有这问题了。
解决方案
- 可以在pull命令后紧接着使用–allow-unrelated-history选项来解决问题(该选项可以合并两个独立启动仓库的历史)。
-git pull origin master --allow-unrelated-histories