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. ES6中map和set用法

    ES6中map和set用法 --转载自廖雪峰的官方网站 一.map Map是一组键值对的结构,具有极快的查找速度. 举个例子,假设要根据同学的名字查找对应的成绩,如果用Array实现,需要两个Arra ...

  2. PHP中include和require

    1.include语句 使用include语句可以告诉PHP提取特定的文件,并载入它的全部内容 1 <?php 2 inlude "fileinfo.php"; 3 4 // ...

  3. BZOJ1188:[HNOI2007]分裂游戏(博弈论)

    Description 聪聪和睿睿最近迷上了一款叫做分裂的游戏.该游戏的规则试:共有n个瓶子,标号为0,1,2.....n-1,第i个瓶子中装有p[i]颗巧克力豆,两个人轮流取豆子,每一轮每人选择3个 ...

  4. 1415. [NOI2005]聪聪和可可【记忆化搜索DP】

    Description Input 数据的第1行为两个整数N和E,以空格分隔,分别表示森林中的景点数和连接相邻景点的路的条数. 第2行包含两个整数C和M,以空格分隔,分别表示初始时聪聪和可可所在的景点 ...

  5. HBase学习之路 (五)MapReduce操作Hbase

    MapReduce从HDFS读取数据存储到HBase中 现有HDFS中有一个student.txt文件,格式如下 95002,刘晨,女,19,IS 95017,王风娟,女,18,IS 95018,王一 ...

  6. 分布式唯一ID的几种生成方案

    前言 在互联网的业务系统中,涉及到各种各样的ID,如在支付系统中就会有支付ID.退款ID等.那一般生成ID都有哪些解决方案呢?特别是在复杂的分布式系统业务场景中,我们应该采用哪种适合自己的解决方案是十 ...

  7. linux下tomcat日志文件现问号乱码

    在使用liunux系统下,使用tomcat记录的日志出现乱码的情况,不能显示中文,中文出现?问号乱码情况,不能正常查看 linux下乱码可能有三个情况 1.linux不含中文支持语言包 打开远程连接客 ...

  8. ruby安装及webStorm配置SCSS

    sass安装: 步骤:(window系统) 1.下载RubyInstaller(v2.4.3),运行安装,基本直接next安装,不过有个add to PATH的选项一定要勾选,这样就不用配置环境变量. ...

  9. 能够让你装逼的10个Python小技巧

      列表推导式 你有一个list: bag = [1, 2, 3, 4, 5] 现在你想让所有元素翻倍,让它看起来是这个样子: [2, 4, 6, 8, 10] 大多初学者,根据之前语言的经验会大概这 ...

  10. 【js】走近小程序(2) 常见问题总结

    一.API请求? 二.基础库兼容? 三.不同页面之间的传值   一.API请求? wx.request({ url: 'test.php', // 仅为示例,并非真实的接口地址 data: { x: ...