推送本地代码到github报错

git push报错

 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/Operater9/guest'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

查了资料后发现是本地没有update到最新版本的项目(git上有README.md文件没下载下来)

本地直接push所以会出错。

执行下面的拉命令,还是不行

$ git pull origin master
From https://github.com/Operater9/guest
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories

执行下面代码

参考https://stackoverflow.com/questions/24114676/git-error-failed-to-push-some-refs-to

git pull --rebase origin master

发现此时已经把github上最新的文件下载下来了:也就是README.md文件。

接着执行推送

git push -u origin master

成功推送本地代码到远程仓库

参考https://blog.csdn.net/u013120247/article/details/53263169

最新文章

  1. WPF计算
  2. Node.js在Windows与Linux下的安装
  3. osx的终端软件iterm2 之 修改外观 和 常用快捷键小结
  4. Dynamic Morphing Square(动态变形矩阵)
  5. Codeforces Round #359 (Div. 2) D. Kay and Snowflake 树DP
  6. ASP.NET获取路径的方法
  7. 射频识别技术漫谈(5)——防冲突【worldsing 笔记】
  8. PHP判断远程图片或文件是否存在
  9. Ubuntu常用命令速查手册-珍藏版-完整版
  10. Cracking the Coding Interview(Stacks and Queues)
  11. GDB调试程序常用命令
  12. Tomcat用法--Servlet开发
  13. Linux防火墙配置—访问外网WEB
  14. yii2 命令行执行php命令 commands(命令)
  15. FCC(ES6写法) Symmetric Difference
  16. 饮冰三年-人工智能-Python-22 Python初识Django
  17. FreeSWITCH收到重复的DTMF信号
  18. ASP.NET中上传图片检测其是否为真实的图片 防范病毒上传至服务器
  19. 学习 TList 类的实现[2]
  20. Red Hat 7.5 Yum Replacement

热门文章

  1. rf中的条件判断与循环
  2. Linux服务器相关信息查询
  3. Docker 0x13: Docker 构建集群/服务/Compose/分布式服务栈
  4. Docker 0x03:Install Docker
  5. ingress controller 注解使用
  6. ELK快速入门(一)基本部署
  7. asp.net中的参数传递:Context.Handler 的用法
  8. jmeter针对websocket协议的压测
  9. 修复wecenter移动版description首页描述一样问题
  10. Sitemap Error : XML declaration allowed only at the start of the document解决方法