解决git报错refusing to merge unrelated histories

PS C:\ycm\test\ts-newProjet> git pull origin master
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories

 在新建项目时报refusing to merge unrelated histories错误,解决方案是:在pull命令后紧接着使用--allow-unrelated-history选项。

原因:出现这个问题的最主要原因还是在于本地仓库和远程仓库实际上是独立的两个仓库。假如我之前是直接clone的方式在本地建立起远程github仓库的克隆本地仓库就不会有这问题了。

 

posted @ 2021-05-08 10:09  入门级小菜  阅读(2238)  评论(0编辑  收藏  举报