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的更多相关文章

  1. Git:fatal: refusing to merge unrelated histories

    如何去解决fatal: refusing to merge unrelated histories 先pull,因为两个仓库不同,发现refusing to merge unrelated histo ...

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

    git pull 失败 ,提示:fatal: refusing to merge unrelated histories 其实这个问题是因为 两个 根本不相干的 git 库, 一个是本地库, 一个是远 ...

  3. 使用git pull提示refusing to merge unrelated histories

    创建了一个origin,两个人分别clone 分别做完全不同的提交 第一个人git push成功 第二个人在执行git pull的时候,提示 fatal: refusing to merge unre ...

  4. 成功解决Git:fatal: refusing to merge unrelated histories

    Get 报错 如果合并了两个不同的开始提交的仓库,在新的 git 会发现这两个仓库可能不是同一个,为了防止开发者上传错误,于是就给下面的提示 fatal: refusing to merge unre ...

  5. 解决Git中fatal: refusing to merge unrelated histories

    原文链接: https://blog.csdn.net/wd2014610/article/details/80854807 Git的报错 在使用Git的过程中有时会出现一些问题,那么在解决了每个问题 ...

  6. git pull 解决 refusing to merge unrelated histories 错误

    解决办法: 1.cmd进入项目的根目录. 2.执行下面的命令:git pull origin master --allow-unrelated-histories.可以提交成功. 3.再次push.

  7. git pull 拉取报错:fatal: refusing to merge unrelated histories

    fatal: refusing to merge unrelated histories(拒绝合并不相关的历史) 使用 git pull origin master --allow-unrelated ...

  8. git无法pull仓库refusing to merge unrelated histories

    本文讲的是把git在最新2.9.2,合并pull两个不同的项目,出现的问题如何去解决fatal: refusing to merge unrelated histories 我在Github新建一个仓 ...

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

    今晚碰到这个问题-- fatal: refusing to merge unrelated histories 想了一下,为什么就这样了? 因为我是先本地创建了仓库,并添加了文件,然后再到github ...

随机推荐

  1. iis和apache共用80端口,IIS代理转发apache

    为什么共用80端口应该不用多说了,服务器上程序运行环境有很多套,都想抢用80端口,所以就有了共用80端口的解决方案. 网上很多的教程一般都是设置APACHE使用默认80端口,代理转发IIS的网站,II ...

  2. jQuery 和 YUI (Yahoo User Interface) 各自的优缺点有哪些?具体的使用场景是怎样的?

    张经纬,前端工程师 知乎用户.赵勇杰.知乎用户 等人赞同 其实jQuery和YUI的侧重点是不一样的. jQuery专注于DOM的操作,他通过继承的方式给传入的对象增加了新的方法,从而使我们可以通过链 ...

  3. BZOJ4517:[SDOI2016]排列计数(组合数学,错排公式)

    Description 求有多少种长度为 n 的序列 A,满足以下条件: 1 ~ n 这 n 个数在序列中各出现了一次 若第 i 个数 A[i] 的值为 i,则称 i 是稳定的.序列恰好有 m 个数是 ...

  4. Kubernetes 1.6新特性

    Kubernetes 1.6已结发布,包括9个Stable特性.12个Beta特性.8个Alpha特性,共29个新特性.Kubernetes 1.6重点关注集群规模扩展和自动化.目前最多支持5000个 ...

  5. linux下ab网站压力测试命令

    http://domain:代表压测域名.   get方法压测:        1)一般get方法压测简单,直接后缀url就ok了,参数直接挂在url后面的?a=1&b=2,         ...

  6. mongodb的学习-5-概念解析

    http://www.runoob.com/mongodb/mongodb-databases-documents-collections.html mongodb中基本的概念是文档.集合.数据库 S ...

  7. C# 实现动态加载DLL插件 及HRESULT:0x80131047处理

    本代码实现DLL的动态加载, 类似PS里的滤镜插件! 1. 建立一个接口项目类库,此处名称为:Test.IPlugin using System; namespace Test.IPlugin { p ...

  8. 1554: SG Value (巧妙的模拟题,也属于思维题)

    1554: SG Value Submit Page    Summary    Time Limit: 5 Sec     Memory Limit: 256 Mb     Submitted: 4 ...

  9. macos版本mojave 安装postgres报错

    mac os 版本mojave 安装postgres报错 事由:前几天升级mac到mojave版本也就是10.14系统,发现对于很多原系统的软件包都不兼容,安装时出现报错. 报错: pthread.h ...

  10. 利用Dropbox中转自己的C2

    利用Dropbox中转自己的C2 0x00 前言 本来的目的呢,是利用dropbox中转自己的c2达到免杀的效果,然后可能是看了文章太久没抓住机会复现,到最后发现已经失效了,会被360拦截,所以好像也 ...