git无法pull仓库refusing to merge unrelated histories (拒绝合并不相关仓库)
原文地址 https://blog.csdn.net/lindexi_gd/article/details/52554159
本文讲的是把git在最新2.9.2,合并pull两个不同的项目,出现的问题如何去解决
如果合并了两个不同的开始提交的仓库,在新的 git 会发现这两个仓库可能不是同一个,为了防止开发者上传错误,于是就给下面的提示
fatal: refusing to merge unrelated histories
如我在Github新建一个仓库,写了License,然后把本地一个写了很久仓库上传。这时会发现 github 的仓库和本地的没有一个共同的 commit 所以 git 不让提交,认为是写错了 origin ,如果开发者确定是这个 origin 就可以使用 --allow-unrelated-histories 告诉 git 自己确定
遇到无法提交的问题,一般先pull 也就是使用 git pull origin master 这里的 origin 就是仓库,而 master 就是需要上传的分支,因为两个仓库不同,发现 git 输出 refusing to merge unrelated histories 无法 pull 内容
因为他们是两个不同的项目,要把两个不同的项目合并,git需要添加一句代码,在 git pull 之后,这句代码是在git 2.9.2版本发生的,最新的版本需要添加 --allow-unrelated-histories 告诉 git 允许不相关历史合并
假如我们的源是origin,分支是master,那么我们需要这样写 git pull origin master --allow-unrelated-histories 如果有设置了默认上传分支就可以用下面代码
git pull --allow-unrelated-histories
- 1

这个方法只解决因为两个仓库有不同的开始点,也就是两个仓库没有共同的 commit 出现的无法提交。如果使用本文的方法还无法提交,需要看一下是不是发生了冲突,解决冲突再提交
git无法pull仓库refusing to merge unrelated histories (拒绝合并不相关仓库)的更多相关文章
- git pull fatal: refusing to merge unrelated histories
1.首先我github有个远程仓库,然后我本地有个仓库 本地仓库我新添加了一个文件,然后我去关联(git remote add origin git@github.com:qshilary/gitte ...
- git push时报错refusing to merge unrelated histories
1. 删除本地项目中的.git目录,然后向远程仓库提交代码的时候,重新配置后再次提交.会有冲突. 解决方式: git remote add origin [//your giturl] git pul ...
- git无法pull仓库refusing to merge unrelated histories
本文讲的是把git在最新2.9.2,合并pull两个不同的项目,出现的问题如何去解决fatal: refusing to merge unrelated histories 我在Github新建一个仓 ...
- 使用git pull提示refusing to merge unrelated histories
创建了一个origin,两个人分别clone 分别做完全不同的提交 第一个人git push成功 第二个人在执行git pull的时候,提示 fatal: refusing to merge unre ...
- git 错误 Reinitialized existing Git repository in /**/***/ 和refusing to merge unrelated histories
报错一: 这句话的意思是 在路径 /Users/jackma/Downloads/lotteryTicket 2/.git/ 现有的Git存储库初始化 ➜ lotteryTicket 2 git:(m ...
- git在使用中出现 refusing to merge unrelated histories如何解决?
一.GIT的使用 # 设置用户名 git config --global user.name "zhaijihai" # 设置用户邮箱 git config --global us ...
- git pull 解决 refusing to merge unrelated histories 错误
解决办法: 1.cmd进入项目的根目录. 2.执行下面的命令:git pull origin master --allow-unrelated-histories.可以提交成功. 3.再次push.
- 提交到开源git时出现:fatal: refusing to merge unrelated histories的解决办法
解决办法 创建本地库和fetch远程分支这些前面的步骤这里略过.可以自行百度. 解决办法: 1.cmd进入项目的根目录. 2.执行下面的命令:git pull origin master --al ...
- android studio提交到开源git时出现:fatal: refusing to merge unrelated histories的解决办法
创建本地库和fetch远程分支这些前面的步骤这里略过.可以自行百度. 解决办法: 1.cmd进入项目的根目录. 2.执行下面的命令:git pull origin master --allow-unr ...
随机推荐
- IBM 3650 M3 yum upgrade后系统无法登陆问题
一.背景 IBM 3650 M3安装了centos7.2操作系统 今天yum upgrade升级centos7.6,重启系统后发现开不了机,报错如下: Failed to set MokListRT: ...
- openstack Q版部署-----界面horizon安装(9)
一.界面的安装 控制节点安装软件包: yum install openstack-dashboard -y [root@linux-node1 ~]# vim /etc/openstack-dashb ...
- pythonのpygame安装
本地环境: python 3.7.0 windows7 64bit pip pygame地址: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame 通 ...
- CodeForces 937D 936B Sleepy Game 有向图判环,拆点,DFS
题意: 一种游戏,2个人轮流控制棋子在一块有向图上移动,每次移动一条边,不能移动的人为输,无限循环则为平局,棋子初始位置为$S$ 现在有一个人可以同时控制两个玩家,问是否能使得第一个人必胜,并输出一个 ...
- csrfguard3.1 部署笔记
1:git clone 导入csrfguard 2:点击菜单栏View->Tool Windows->Maven projects 3:Lifecycle clean build 4:t ...
- jmeter设置全局变量
2017年4月20日 10:07:37 星期四 情景, 从第一个请求的结果中匹配出code, 当作参数去做下次请求 以抢红包为例: 1. 创建红包, 并从返回结果中获取红包code 2. 将code设 ...
- Linux更新阿里源
阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/ CentOS系统更换软件安装源: 第一步:备份你的原镜像文件,以免出错后可以恢复. mv /etc/yum.rep ...
- Day8--------------源码安装
yun install python 在yum源中 wget 地址 下载 下载---------->解包-------->运行config脚本添加编译参数--------->编译(g ...
- Solidity基础
方法和匿名方法: funcion name(<parameter types>){public|private|internal|external}[constant][payable][ ...
- python1113
点点滴滴才可以来开距离,人与人的差距是在点点滴滴中拉开的 break 语句可以跳出 for 和 while 的循环体的当前循环 continue语句被用来告诉Python跳过当前循环块中的剩余语句,然 ...