refusing to merge unrelated histories

问题

在执行git pull拉取和git push推送或者是分支合并的操作时,报错refusing to merge unrelated histories

解决

这是因为仓库之间没有建立起关联导致的,需要在命令后面加上 --allow-unrelated-histories

先进行拉取操作避免推送时发送冲突

$git pull origin master --allow-unrelated-histories

1

拉取成功后,进行推送操作

$ git push <远程主机名> <本地分支名>:<远程分支名>

也就是

$git push origin master:master

提交成功

相关推荐
代码AC不AC2 天前
【Linux】版本控制器Git
linux·git·gitee
TTGGGFF3 天前
开源项目分享 : Gitee热榜项目 2025-11-19 日榜
gitee·开源
艾莉丝努力练剑4 天前
【Git:分支管理】Git 分支管理完全指南:从创建、合并到冲突解决
linux·服务器·人工智能·git·gitee·centos·分支管理
TTGGGFF5 天前
开源项目分享 : Gitee热榜项目 2025-11-17 日榜
gitee·开源
TTGGGFF7 天前
开源项目分享:Gitee热榜项目 2025年11月第三周 周榜
gitee·开源
TTGGGFF7 天前
开源项目分享 : Gitee热榜项目 2025-11-14 日榜
gitee·开源
李浩洋937 天前
Typora picgo-core gitee图片上传设置
gitee·typora·图片上传
小叮当⇔7 天前
Gitee完全新手教程
gitee
草莓熊Lotso8 天前
Git 本地操作入门:版本控制基础、跨平台部署与仓库核心流程
开发语言·人工智能·经验分享·git·后端·架构·gitee
melt_10269 天前
【gitee账号设置】git多个账号在多台电脑上使用
git·gitee·git账号管理