This is usually caused by another repository pushing:refusing to merge unrelated histories
来源:互联网 发布:汽车行业制图软件 编辑:程序博客网 时间:2024/05/29 19:10
事情是这样的,我先是在一个git好了的目录连接了一个仓库创建了一个项目并发布到了那个仓库上,然后我又在idea中创建了一个更完整的项目,又连接到了这个git仓库中(俩项目名称相同),然后就想发布上去,结果add ,commit完成之后要push时,出现了这一幕
error: failed to push some refs to '我相关联的git仓库'hint: Updates were rejected because the remote contains work that you do!refs/heads/master:refs/heads/master[rejected] (fetch first)Donehint: not have locally. This is usually caused by another repository pushinghint: to the same ref. You may want to first integrate the remote changeshint: (e.g., 'git pull ...') before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details.
根据它的提示我大概知道是冲突了因为之前提交的并不完整,我的本意是想用这个来覆盖之前的,于是我就想先pull下来解决冲突(事实上我pull下来不会影响我这个项目因为我在之前的目录下把不完整的项目给删除了,这个时候我的仓库其实是空的,但是会遗留下git自己的备份数据比如备份的版本log),结果我在pull的时候发生了如下一幕
warning: no common commitsremote: 对象计数中: 101, 完成. remote: 压缩对象中: 100% (87/87), 完成. remote: Total 101 (delta 43), reused 0 (delta 0) Receiving objects: 100% (101/101), 17.27 KiB | 0 bytes/s, done.Resolving deltas: 100% (43/43), done.From 我相关联的git仓库 * branch master -> FETCH_HEAD * [new branch] master -> origin/masterfatal: refusing to merge unrelated histories说是拒绝让我合并不相关的历史
解决方案:
执行如下命令
git pull origin master--allow-unrelated-histories
然后就会解决冲突,如果说你的仓库项目跟你要上传的项目有冲突那你就解决冲突再push(前面说了我的仓库其实是空的只保留了git自己的log)
然后再push上去就成功了
Counting objects: 132, done.Delta compression using up to 4 threads.Compressing objects: 100% (80/80), done.Writing objects: 100% (132/132), 22.17 KiB | 0 bytes/s, done.Total 132 (delta 56), reused 57 (delta 33)remote: 处理 delta 中: 100% (56/56), 完成. To 我关联的仓库bdd1ac7..30c6958Done
git新手做如上笔记
阅读全文
1 0
- This is usually caused by another repository pushing:refusing to merge unrelated histories
- refusing to merge unrelated histories
- refusing to merge unrelated histories
- faial: refusing to merge unrelated histories
- git fatal: refusing to merge unrelated histories
- git-bug-“refusing to merge unrelated histories”
- fatal: refusing to merge unrelated histories 解决方案
- fatal: refusing to merge unrelated histories
- fatal: refusing to merge unrelated histories
- git : refusing to merge unrelated histories
- git pull:refusing to merge unrelated histories
- git pull 失败 ,提示:fatal: refusing to merge unrelated histories
- git无法pull仓库refusing to merge unrelated histories
- fatal: refusing to merge unrelated histories的解决方案
- git无法pull仓库refusing to merge unrelated histories
- git无法pull仓库refusing to merge unrelated histories
- git无法pull仓库refusing to merge unrelated histories
- git无法pull仓库refusing to merge unrelated histories
- 关于mysql中where条件的类型自动转换
- ZYNQ XC7Z030平台Linux+裸机AMP实现(官方文档1078、1079)
- 协程
- WebStrom 自动补全快捷键
- Mac显示隐藏文件命令
- This is usually caused by another repository pushing:refusing to merge unrelated histories
- c#笔记(二)
- Reactor模式软文
- js动态改变地址栏url,不刷新页面
- java死锁的原因分析及解锁和预防措施
- mysql事务
- Visual Studio 实用插件
- C++之析构函数和构造函数调用时间---补充(2)《Effective C++》
- lnmp