android studio提交到开源git时出现:fatal: refusing to merge unrelated histories的解决办法

创建本地库和fetch远程分支这些前面的步骤这里略过。可以自行百度。

解决办法:

1.cmd进入项目的根目录。

2.执行下面的命令:git pull origin master --allow-unrelated-histories。可以提交成功。

3.再次push。

有其它的好办法,欢迎建议。

原文地址:https://www.cnblogs.com/xiangxinhouse/p/8254120.html

时间: 2024-08-03 18:50:43

android studio提交到开源git时出现:fatal: refusing to merge unrelated histories的解决办法的相关文章

GIt -- fatal: refusing to merge unrelated histories 问题处理

今晚碰到这个问题-- fatal: refusing to merge unrelated histories 想了一下,为什么就这样了? 因为我是先本地创建了仓库,并添加了文件,然后再到github网上建仓库,项目名称一样的,这样一来当我想关联远程仓库,提交代码就报错了 解决方法 $ git pull origin master --allow-unrelated-histories --allow-unrelated-histories 参数的意思是合并仓库的时候,允许不相关的历史的提交内容

git 出现 fatal: refusing to merge unrelated histories 错误

git pull 失败 ,提示:fatal: refusing to merge unrelated histories 其实这个问题是因为 两个 根本不相干的 git 库, 一个是本地库, 一个是远端库, 然后本地要去推送到远端, 远端觉得这个本地库跟自己不相干, 所以告知无法合并 具体的方法, 一个种方法: 是 从远端库拉下来代码 , 本地要加入的代码放到远端库下载到本地的库, 然后提交上去 , 因为这样的话, 你基于的库就是远端的库, 这是一次update了 第二种方法: 使用这个强制的方

Git fatal: refusing to merge unrelated histories

$ git pull origin masterFrom gitee.com:zrxisme/testLog * branch            master     -> FETCH_HEADfatal: refusing to merge unrelated histories 原因:使用pull操作的时候出现以上错误,原因很简单,你提交的内容和远程仓库里的内容不同的,有些小伙伴很奇怪,我明明从远程仓库clone下来的,为什么说是两个不同的内容呢?其实这是新手经常犯的一个错误,大多数情况

git无法pull仓库refusing to merge unrelated histories

http://blog.csdn.net/lindexi_gd/article/details/52554159 本文讲的是把Git在最新2.9.2,合并pull两个不同的项目,出现的问题如何去解决fatal: refusing to merge unrelated histories 我在Github新建一个仓库,写了License,然后把本地一个写了很久仓库上传. 先pull,因为两个仓库不同,发现refusing to merge unrelated histories,无法pull 因为

Git:fatal: refusing to merge unrelated histories

如何去解决fatal: refusing to merge unrelated histories 先pull,因为两个仓库不同,发现refusing to merge unrelated histories,无法pull 因为他们是两个不同的项目,要把两个不同的项目合并 git需要添加一句代码,然后再git pull 这句代码是在git 2.9.2版本发生的 最新的版本需要添加 --allow-unrelated-histories 假如我们的源是origin,分支是master,那么我们需要

git merge合并时遇上refusing to merge unrelated histories的解决方案

如果git merge合并的时候出现refusing to merge unrelated histories的错误,原因是两个仓库不同而导致的,需要在后面加上--allow-unrelated-histories进行允许合并,即可解决问题 如果还不能解决问题,就把本地的remote删除,重新git remote add添加远程仓库,再按上面的方法来,问题解决. git checkout master #切换到要提交代码的分支 git pull origin master --allow-unr

Git 报错:fatal: refusing to merge unrelated histories

背景:[接上篇git push 出错的随笔]当 pull 远端仓库到本地的时候,出现以下错误: 错误情况: 出错原因:主要原因还是在于本地仓库和远程仓库实际上是独立的两个仓库,假如我之前是直接以 clone 的方式在本地建立起远程 github 仓库克隆的本地仓库就不会有这个问题了. 解决方式:可以在 pull 命令后紧接着使用 --allow-unrelated-history 选项来解决问题(该选项可以合并连个独立启动仓库的历史) $ git pull origin master --all

Android Studio一直build、一直refreshing、一直buiding gradle project into的终极解决办法

打开我的电脑,打开C:\Users\用户名, 把红圈的文件夹都删了 如果AndroidStudioProjects文件夹里那些project都不重要,也可以跟红圈文件夹删了, 然后再打开android studio,新建project,等待十分钟.

Git报错-refusing to merge unrelated histories

执行git pull 时报错: 出现这个问题的最主要原因还是在于本地仓库和远程仓库实际上是独立的两个仓库.假如我之前是直接clone的方式在本地建立起远程github仓库的克隆本地仓库就不会有这问题了. 可以在pull命令后紧接着使用--allow-unrelated-history选项来解决问题(该选项可以合并两个独立启动仓库的历史). 命令: $git pull origin master –allow-unrelated-histories 以上是将远程仓库的文件拉取到本地仓库了. 原文地