推送本地代码到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

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

  1. git push 时发生错误 error: src refspec master does not match any. error: failed to push some refs to

    很多相关解决办法都是最后要 push 到远端的 master 上,但很多其实要求不能把个人的修改内容直接 push 到 master 主分支. 因此,当我想将本地 feature/work1 分支的修 ...

  2. git 本地推送远程仓库报错: error: failed to push some refs to 'https://github.com/yangtuothink/mxonline.git'

    报错现象 添加远程仓库后 推送代码的时候报错 报错分析 远程代码和本地代码不匹配问题 远程初始仓库的创建有些默认 的 README什么的本地是没有的 需要先同步后再上传 报错解决 git push - ...

  3. 解决 failed to push some refs to 'git@github.com:zle1992/head-first-java' hint: Updates were rejected because the tip of your curr

    问题描述: 寒假之前用实验室电脑push到github 上head first java 的程序,寒假回家后,想用自己的笔记本继续编,继续push . 我先从github下载zip到本地,然后 解压后 ...

  4. git 解决push报错:[rejected] master -> master (fetch first) error: failed to push some refs to

    今天对代码进行了修改优化,然后往往远程push,但push后报错了 git操作 git add . git commit -m"fix" git push origin maste ...

  5. To ssh://xxx.com:8022/test/project.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'ssh://xxx.com:8022/test/project.git'

    To ssh://xxx.com:8022/test/project.git ! [remote rejected] master -> master (pre-receive hook dec ...

  6. git push -u origin master error: failed to push some refs to

    1.问题描述 $ git push -u origin master To github.com:[github_name]/[github_repository_name].git ! [rejec ...

  7. git push origin master出错:error: failed to push some refs to

    1.输入git push origin master 出错:error: failed to push some refs to 那是因为本地没有update到最新版本的项目(git上有README. ...

  8. Git error: hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused b

    hint: Updates were rejected because the remote contains work that you dohint: not have locally. This ...

  9. Git本地分支版本号过低导致的push错误 error: failed to push some refs to ... 及兴许amend

    今天在用git的时候遇到了一个问题.在想远程分支push的时候,出现了以下的错误: ! [remote rejected] master -> refs/for/master (change 1 ...

随机推荐

  1. jmeter使用小结

    写这篇短文主要想详细介绍一下jmeter中取样器.逻辑控制器.前置处理器.后置处理器.定时器.配置元件等,可能看起来比较繁杂,其实里面很多操作是类似的,一篇总结和记录的博客: jmeter官方用户手册 ...

  2. VS2015配置Qt5

    目录 需要准备的东西 VS2015 Qt5 VS2015 Qt插件 rc.exe无法启动 基于CMake的Qt工程 reference 需要准备的东西 Visual Studio 2015 Qt5 V ...

  3. Educational Codeforces Round 65 (Rated for Div. 2)题解

    Educational Codeforces Round 65 (Rated for Div. 2)题解 题目链接 A. Telephone Number 水题,代码如下: Code #include ...

  4. python 实现 DES CBC模式加解密

    # -*- coding=utf-8-*- from Crypto.Cipher import DES import base64 """ des cbc加密算法 pad ...

  5. Java动态代理--CGLib实现

    上一篇说了通过JDK实现实现了动态代理,但是用JDK实现代理,要求所代理的类必须实现一个接口.如果我们类不实现接口,这就在无法使用JDK提供的Proxy来实现动态代理,这个时候我们应该怎么办呢?我们找 ...

  6. JSP中EL表达式的比较符号、字符串比较

    在EL表达式中我们可以使用运算符以达到我们想要的结果,运算符按作用分为以下几种: 1.算术运算符 +  例如:${6+6} .注意:在EL表达式中的‘+’只有数学运算的功能,没有连接符的功能,它会试着 ...

  7. Apache是什么?

    Apache HTTP Server(简称Apache)是Apache软件基金会的一个开放源码的网页服务器,可以在大多数计算机操作系统中运行, 由于其多平台和安全性被广泛使用,是最流行的Web服务器端 ...

  8. Redis笔记搬迁

      Redis原理 从不同的角度来详细介绍redis 存储方式 数据结构 Redis的过期策略 数据淘汰策略 高可用 主从复制 分布式缓存 哨兵 缓存异常 缓存穿透 缓存雪崩 缓存与数据库数据一致性 ...

  9. artillery 学习一 简单使用

    artillery 是一个不错的负载测试套件,功能很强大,支持多协议 安装 npm install -g artillery --unsafe-perm 运行一个简单的快速测试 artillery q ...

  10. matlab 只安装部分产品