您当前的位置: 首页 >  git

星夜孤帆

暂无认证

  • 3浏览

    0关注

    626博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

记Git报错-refusing to merge unrelated histories

星夜孤帆 发布时间:2020-07-06 17:36:11 ,浏览量:3

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
提交成功。

 

关注
打赏
1636984416
查看更多评论
立即登录/注册

微信扫码登录

0.0467s