git pull fatal: refusing to merge unrelated histories
1.首先我github有个远程仓库,然后我本地有个仓库
本地仓库我新添加了一个文件,然后我去关联(git remote add origin git@github.com:qshilary/gittest.git)以后
2.Git push发现报错了
eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git push origin master
Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.
fatal: remote error:
is not a valid repository name
Email support@github.com for help
eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git remote add origin git@github.com:qshilary/gittest.git
fatal: remote origin already exists.
eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git push origin master
fatal: remote error:
is not a valid repository name
Email support@github.com for help
3.然后我Git remote -v发现确实关联了,然后需要删除重新关联
eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git remote -v
origin git@github.com:qshilary/gittest.gitgit@github.com:qshilary/gittest.git (fetch)
origin git@github.com:qshilary/gittest.gitgit@github.com:qshilary/gittest.git (push)
eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git remote add origin git@github.com:qshilary/gittest.git
4.再推发现还是报错了
eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git push origin master
To github.com:qshilary/gittest.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:qshilary/gittest.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
5.是因为远程已经有个工程了,但是我本地没有,所以肯定推不上去,需要Git pull一下
eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git pull
Warning: Permanently added the RSA host key for IP address '52.74.223.119' to the list of known hosts.
warning: no common commits
remote: Counting objects: 42, done.
remote: Total 42 (delta 0), reused 0 (delta 0), pack-reused 42
Unpacking objects: 100% (42/42), done.
From github.com:qshilary/gittest
* [new branch] master -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
6.Git pull发现报错了
eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git branch --set-upstream-to=origin/master master
Branch 'master' set up to track remote branch 'master' from 'origin'.
eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git pull
fatal: refusing to merge unrelated histories
eqiasui@CN00214190 MINGW64 ~/Documents/practice (master)
$ git pull origin master --allow-unrelated-histories
From github.com:qshilary/gittest
* branch master -> FETCH_HEAD
Merge made by the 'recursive' strategy.
Git-2.9.0-64-bit.exe | Bin 0 -> 31502824 bytes
git在最新2.9.2,合并pull两个不同的项目,出现的问题如何去解决fatal: refusing to merge unrelated histories
我在Github新建一个仓库,写了License,然后把本地一个写了很久仓库上传。
先pull,因为两个仓库不同,发现refusing to merge unrelated histories
,无法pull
因为他们是两个不同的项目,要把两个不同的项目合并,git需要添加一句代码,在git pull
,这句代码是在git 2.9.2版本发生的,最新的版本需要添加--allow-unrelated-histories
假如我们的源是origin,分支是master,那么我们 需要这样写git pull origin master ----allow-unrelated-histories
需要知道,我们的源可以是本地的路径
git pull fatal: refusing to merge unrelated histories的更多相关文章
- Git:fatal: refusing to merge unrelated histories
如何去解决fatal: refusing to merge unrelated histories 先pull,因为两个仓库不同,发现refusing to merge unrelated histo ...
- git 出现 fatal: refusing to merge unrelated histories 错误
git pull 失败 ,提示:fatal: refusing to merge unrelated histories 其实这个问题是因为 两个 根本不相干的 git 库, 一个是本地库, 一个是远 ...
- 使用git pull提示refusing to merge unrelated histories
创建了一个origin,两个人分别clone 分别做完全不同的提交 第一个人git push成功 第二个人在执行git pull的时候,提示 fatal: refusing to merge unre ...
- 成功解决Git:fatal: refusing to merge unrelated histories
Get 报错 如果合并了两个不同的开始提交的仓库,在新的 git 会发现这两个仓库可能不是同一个,为了防止开发者上传错误,于是就给下面的提示 fatal: refusing to merge unre ...
- 解决Git中fatal: refusing to merge unrelated histories
原文链接: https://blog.csdn.net/wd2014610/article/details/80854807 Git的报错 在使用Git的过程中有时会出现一些问题,那么在解决了每个问题 ...
- git pull 解决 refusing to merge unrelated histories 错误
解决办法: 1.cmd进入项目的根目录. 2.执行下面的命令:git pull origin master --allow-unrelated-histories.可以提交成功. 3.再次push.
- git pull 拉取报错:fatal: refusing to merge unrelated histories
fatal: refusing to merge unrelated histories(拒绝合并不相关的历史) 使用 git pull origin master --allow-unrelated ...
- git无法pull仓库refusing to merge unrelated histories
本文讲的是把git在最新2.9.2,合并pull两个不同的项目,出现的问题如何去解决fatal: refusing to merge unrelated histories 我在Github新建一个仓 ...
- GIt -- fatal: refusing to merge unrelated histories 问题处理
今晚碰到这个问题-- fatal: refusing to merge unrelated histories 想了一下,为什么就这样了? 因为我是先本地创建了仓库,并添加了文件,然后再到github ...
随机推荐
- Jmeter入门3 http请求—content-type与参数
本文讲三种content-type以及在Jmeter中对应的参数输入方式 第一部分:目前工作中涉及到的content-type 有三种: content-type:在Request Headers里, ...
- jquery validation验证身份证号、护照、电话号码、email
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Undefined function or method 'deploywhich' for input arguments of type 'char'
在进行matlab和java混合编程的时候.由matlab打包,把m文件转换为jar文件.供java调用.有时在Tomcat中调用此类jar类会出现如题或者以下的错误: ??? Error using ...
- Golang 临时对象池 sync.Pool
Go 1.3 的sync包中加入一个新特性:Pool.官方文档可以看这里http://golang.org/pkg/sync/#Pool 这个类设计的目的是用来保存和复用临时对象,以减少内存分配,降低 ...
- luogu P3391 【模板】文艺平衡树(Splay)
嘟嘟嘟 突然觉得splay挺有意思的-- 这道题只有一个任务:区间翻转. 首先应该知道的是,splay和线段树一样,都可以打标记,然后走到每一个节点之前先下传. 那怎么打标记呢?还应该有"区 ...
- Java并发编程--4.Executor框架
简介 Executor框架是启动,管理线程的API, 它的内部实现是线程池机制,它有很多好处,比如使任务提交和任务执行解耦合,防止this逃逸:它的主要API包括: Executor, Execut ...
- 既生 Redis 何生 LevelDB ?
了解 Redis 的同学都知道它是一个纯内存的数据库,凭借优秀的并发和易用性打下了互联网项的半壁江山.Redis 之所以高性能是因为它的纯内存访问特性,而这也成了它致命的弱点 —— 内存的成本太高.所 ...
- Python 把数据库的数据导出到excel表
import io,xlwt def export_excel(request): """导出数据到excel表""" list_obj = ...
- 我的linux shell 脚本头部
#!/bin/bash #################################################### # version:1.01 # # link:http://www. ...
- Spring Cloud 微服务项目实现总架构一
Spring Cloud 服务是一种分布式服务,包括配置管理,服务发现,断路器,智能路由,微代理,控制总线,一次性令牌,全局锁,主节点选举, 分布式session, 集群状态等公共组件. 一 注册机 ...