问题:

1、本地初始化了git仓库,放了一些文件进去并进行了add操作和commit提交操作;

2、github创建了git仓库并建立了README,.gitignore等文件;

3、本地仓库添加了github上的git仓库作为远程仓库,起名origin;

  git remote add origin 远程仓库地址

4、本地仓库也远程仓库关联

git branch --set-upstream-to=origin/master master

这个时候就出现了

解决问题

如果直接pull,就会出现一下错误,

refusing to merge unrelated histories

正确姿势:

git pull origin master --allow-unrelated-histories

然后本地远程仓库关联

git branch --set-upstream-to=origin/master master

最后就可以push了;

总结一下:本地仓库有文件,远程仓库也有文件,正确姿势:

1、git remote add origin 远程仓库地址2、git pull origin master --allow-unrelated-histories3、git branch --set-upstream-to=origin/master master4、git push

解决“error: the requested upstream branch ‘origin/master‘ does not exist”相关推荐

  1. git中出现”the requested upstream branch ‘origin/master‘ does not exist“问题的解决

    在使用git上传项目到远程仓库时发现的一个问题,在网上搜索到解决办法后觉得这个问题比较典型,所以写个博客记录下来. 问题产生 在本地有一个git项目,已经提交到本地仓库,现在想把这个项目上传到远程仓库 ...

  2. IDEA在push出现Pushed master to new branch origin/master错误

    一.在IDEA中第一次Push项目可能会显示如下的错误红色框框中: 弹出Pushed master to new branch origin/master 2.解决这个问题就要打开Terminal终端 ...

  3. Pushed master to new branch origin/master

    在IDEA里,写完的代码git到github上时,出现Pushed master to new branch origin/master 解决办法 解决这个问题就要打开Terminal终端, 切换到项 ...

  4. 【已解决】github中git push origin master出错:error: failed to push some refs to(亲测)

    [背景] 折腾: [记录]将googlecode上面的crifanLib迁移到Github上 期间出错: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...

  5. idea上传已有项目到git报错Push rejected:push to origin/master was rejected

    出现这种错误,第一种可能是公司有规定,代码必须按照某种格式提交,否则会报错.比如有些要求commit时候,加上特有的标签啊之类的. 第二种则可能是创建远程仓库时候,已经建立了.gitignore文件, ...

  6. Git master branch has no upstream branch的解决

    Git master branch has no upstream branch的解决 在push代码时,出现"git master branch has no upstream branc ...

  7. 新建本地仓库,同步远程仓场景,出现git branch --set-upstream-to=origin/master master 解决方法...

    1.本地创建一个本地仓库  2.关联远程端: git remote add origin git@github.com:用户名/远程库名.git 3.同步远程仓库到本地 git pull 这个时候会报 ...

  8. Git Your branch is ahead of ‘origin/master‘ by X commits解决方法

    Git Your branch is ahead of 'origin/master' by X commits解决方法 参考文章: (1)Git Your branch is ahead of 'o ...

  9. Git Your branch is ahead of 'origin/master' by X commits解决方法

    解决办法: 如果当前分支的东西想保留,就直接提交到线上分支 git push origin [当前分支名] 如果当前分支的东西不要了,目的是与线上保持一致 git reset --hard origi ...

最新文章

  1. grunt 打包前端代码
  2. php获取ip 1,为什么php获取ip显示::1?
  3. 软件概要设计和详细设计的区别
  4. 高中生毕业落榜学计算机,高中毕业落榜了 不想复读怎么办_2019年高考落榜怎么办...
  5. Android代码入侵原理解析(一)
  6. WPF 实现展示反应盘、者试剂仓控件
  7. 秀秀自己电脑上的好东西
  8. ajaxFileUpload.js插件支持多文件上传的方法
  9. 吐血干货,直播首屏耗时400ms以下的优化实践
  10. Android stdio安装
  11. c语言20%3c=10,C语言  练习题(2)
  12. MODIS数据批量下载工具
  13. python百度贴吧发帖签到_百度贴吧签到脚本
  14. Python IndentationError: expected an indented block
  15. Excel如何批量插入删除复选框
  16. STM32F7--->FMC(可变存储控制器) Flexible Memory Controller
  17. 关于仿古砖的历史,你知道多少?
  18. 成绩查询系统 mysql_基于PHP和MYSQL的成绩查询系统
  19. 云计算安全测评:云应用安全
  20. 人工智能时代,如何让机器狗听懂你说的话?

热门文章

  1. 腾讯云不同账号的服务器,网站如何迁移
  2. 使用DataRobot和Databricks简化大数据和AI
  3. 图像压缩的王者:Image Optimizer V5.1 汉化修正绿色版
  4. 峰哥读者从创业失败延毕一年,到考研985拿大厂offer,分享考研经历与经验
  5. 玩转C语言for循环
  6. 【Spark+Hadoop+Hive+MySQL+Presto+SpringBoot+Echarts】基于大数据技术的用户日志数据分析及可视化平台搭建项目
  7. 新手程序员未来发展计划
  8. 计算机毕业设计源码案例基于ssm幼儿园管理系统
  9. 【Excel】日期格式
  10. java word库_几种解析Word文档的Java类库比较