推送本地代码到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. IDEA集成jacoco

    穷乡僻壤的人犯罪率低,不是因为他们高尚,而是因为没有选择:没有选择就不会有痛苦. --<黑冰·郭小鹏> 参考资料:https://www.jacoco.org/jacoco/trunk/d ...

  2. MATLAB问题小集合

    1.未定义与 'struct' 类型的输入参数相对应的函数 'tb_optparse' 在运行matlab程序时,出现上述错误. 原因是tb_optparse在common文件夹里面,没在robot文 ...

  3. Java Spring Boot 一些调试技巧

    配置文件的管理 有的时候我们希望开发环境和测试环境的配置文件放在一起可以快速切换 spring boot 为我们提供了很方便的的选项 在 application.properties 中只需要添加属性 ...

  4. 20180418模拟赛T2——Gym

    Gym (Gym.cpp/c/pas) 题目描述 Description 木吉终于到达了 VAN 様的老巢 gym,然而他已经是孤身一人.他决定和 VAN 様来一场对决.他决定和 VAN 様玩♂跑♂步 ...

  5. PyQt5中的窗口显示控制

    setWindowState(state) #设置窗口状态 Qt.WindowNoState 无状态-正常状态 Qt.WindowMinimized 最小化 Qt.WindowMaximized 最大 ...

  6. RxSwift 在本质上简化了开发异步程序

    RxSwift 是一个组合异步和事件驱动编程的库,通过使用可观察序列和功能样式运算符来,从而允许通过调度程序进行参数化执行. RxSwift 在本质上简化了开发异步程序,允许代码对新数据作出反应,并以 ...

  7. 什么是JavaEE,什么是Spring

    作者:大宽宽链接:https://www.zhihu.com/question/268742981/answer/341770209来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请 ...

  8. JavaScript基础12——运动

    运动原理 运动的原理:      让某件物品沿着某种方向随着时间的变化改变位置 setInterval(function(){ obox.style.left = obox.offsetLeft+10 ...

  9. chart.xkcd 可绘制粗略,开通,手绘样式的图表库

    chart.xkcd 可以用来绘制手绘样式的图表,使用简单,样式也挺好看 简单使用 代码 index.html <!DOCTYPE html> <html lang="en ...

  10. P1501 [国家集训队]Tree II LCT

    链接 luogu 思路 简单题 代码 #include <bits/stdc++.h> #define ls c[x][0] #define rs c[x][1] using namesp ...