Git报错-refusing to merge unrelated histories

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sinat_29675423/article/details/86360638

问题描述

github创建了git仓库并建立了README文件,
本地添加远程仓库:$git remote add origin
进行提交时,Git报错-refusing to merge unrelated histories

原因分析

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

解决办法

先进行
$git pull origin master –allow-unrelated-histories

$git push origin master

猜你喜欢

转载自blog.csdn.net/sinat_29675423/article/details/86360638