https://blog.csdn.net/u012145252/article/details/80628451
本地仓库在想做同步远程仓库到本地为之后本地仓库推送到远程仓库做准备时报错了,错误如下:
Git Pull Failed
POST git-upload-pack (294 bytes)
From https://gitee.com/jakhyd/RabbitMQ
* branch master -> FETCH_HEAD
= [up to date] master -> origin/master
refusing to merge unrelated histories
(拒绝合并不相关的历史)
解决出现这个问题的最主要原因还是在于本地仓库和远程仓库实际上是独立的两个仓库。假如我之前是直接clone的方式在本地建立起远程github仓库的克隆本地仓库就不会有这问题了。
命令:
git pull origin master --allow-unrelated-histories
以上是将远程仓库的文件拉取到本地仓库了。 紧接着将本地仓库的提交推送到远程github仓库上,使用的命令是:
git push :
也就是
git push origin master:master
提交成功。