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. 装office系统软件

    在电脑里搜索 SW_DVD5_Office_Professional_Plus_2010w_SP1_64Bit_ChnSimp_CORE_MLF_X17-76742 如果已经安装过了,有错误,直接进行 ...

  2. Servlet 启动顺序

    在servlet的配置当中,<load-on-startup>1</load-on-startup>的含义是: 标记容器是否在启动的时候就加载这个servlet. 当值为0或者 ...

  3. BZOJ4522:[CQOI2016]密钥破解(Pollard-Rho,exgcd)

    Description 一种非对称加密算法的密钥生成过程如下: 1. 任选两个不同的质数 p ,q 2. 计算 N=pq , r=(p-1)(q-1) 3. 选取小于r ,且与 r 互质的整数 e  ...

  4. Python 2.7和3.6爬取妹子图网站单页测试图片

    1.url= http://www.mzitu.com/74100/x,2为1到23的值 2.用到模块 os 创建文件目录; re模块正则匹配目录名 图片下载地址; time模块 限制下载时间;req ...

  5. shell基础--字符串和变量的操作

    一.统计字符串长度 1.wc –L [root@~_~day4]# echo "hello" | wc -L 5 2.expr length string [root@~_~day ...

  6. 8 个不常见但很有用的 Git 命令

    1. 拉取远程代码并且覆盖本地更改 2. 列出远程和本地所有分支 3. 强制更新远程分支 4. 回滚一个 merge 5. 修改之前的提交记录或者很久前提交的记录 6. 使用多个远程代码库,并且使用多 ...

  7. Oracle 数据库纯dos代码操作

    1. 安装成功后进入DOS界面操作 在进行以下操作时,需启动Oracle服务. A.进入sql界面:开始--运行--cmd:输入sqlplus 回车 提示输入正确的用户名和密码 B.开始—>所有 ...

  8. PAT乙级1002

    1002 写出这个数 (20 分)   读入一个正整数 n,计算其各位数字之和,用汉语拼音写出和的每一位数字. 输入格式: 每个测试输入包含 1 个测试用例,即给出自然数 n 的值.这里保证 n 小于 ...

  9. Manifest XML signature is not valid(安装ClickOnce签名未通过验证)

    转载:http://stackoverflow.com/questions/12826798/manifest-xml-signature-is-not-valid 安装时,我的问题:  PLATFO ...

  10. ios 开发UI篇—UITextView

    概述 UITextView可滚动的多行文本区域 UITextView支持使用自定义样式信息显示文本,并支持文本编辑.您通常使用文本视图来显示多行文本,例如在显示大型文本文档的正文时. UITextVi ...