今天对代码进行了修改优化,然后往往远程push,但push后报错了

git操作

git add .
git commit -m"fix"
git push origin master:dev-gaochao

报错信息

To https://amc-msra.visualstudio.com/trading-algo/_git/real-trading
! [rejected] master -> dev-gaochao (fetch first)
error: failed to push some refs to 'https://amc-msra.visualstudio.com/trading-algo/_git/real-trading'
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.

原因

之所以出现这个原因,是因为我在线上生成、编辑了README.md文件,而本地代码文件中不包含它,所以线上线下就对不上了。

解决

将线上、线下代码进行合并

git pull --rebase origin dev-gaochao

然后再进行push

git push origin master:dev-gaochao

成功:

Enumerating objects: 11, done.
Counting objects: 100% (11/11), done.
Delta compression using up to 4 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 1.90 KiB | 487.00 KiB/s, done.
Total 7 (delta 4), reused 0 (delta 0)
remote: Analyzing objects... (7/7) (13 ms)
remote: Checking for credentials and other secrets... (1/1) done (1008 ms)
remote: Storing packfile... done (157 ms)
remote: Storing index... done (87 ms)
To https://amc-msra.visualstudio.com/trading-algo/_git/real-trading
1919525..6f3asa4dd6 master -> dev-gaochao

git 解决push报错:[rejected] master -> master (fetch first) error: failed to push some refs to的更多相关文章

  1. git提交远程报错[rejected] master -> master (fetch first)

    1 先下载git for windows 然后一直点下一步安装. 2 安装之后,选择git gui.生成ssh 链接 git 公钥. 用命令也可以: $ ssh-keygen -t rsa -C &q ...

  2. 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 ...

  3. 关联吸纳的remote首次push报错rejected

    F:\abb-iot\DmsAPI\DmsAPI (master -> origin) λ git push --set-upstream github master To github.com ...

  4. Git push时报错 ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to......

    今天在使用Git回退到之前某个版本的代码时,进行push时出现如下错误: ! [remote rejected] master -> master (pre-receive hook decli ...

  5. rpm安装rpm-package报错:Header signature NOKEY 和 error: Failed dependencies:

    以前经常遇到这个问题,一直未有记录,今天记录下来: 在安装rpm包的时候报错误如下: Question 1: warning: *.rpm: Header V3 DSA signature: NOKE ...

  6. [原]rpm安装rpm-package报错:Header signature NOKEY 和 error: Failed dependencies:

    以前经常遇到这个问题,一直未有记录,今天记录下来: 在安装rpm包的时候报错误如下: Question 1: warning: *.rpm: Header V3 DSA signature: NOKE ...

  7. git上传文件夹报错: ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/taminachen/rjxm.git' hint: Updates were rejected because the remote contains work

    使用git上传本地文件夹到远程仓库,使用如下命令:git push -u origin master时报错 原因是在GitHub创建仓库时创建了readme文件,但是本地没有这个文件,造成本地目录与远 ...

  8. git push报错! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://gitee.com/XXX.git

    git pull origin master --allow-unrelated-histories  //把远程仓库和本地同步,消除差异 git add . git commit -m"X ...

  9. git 报错:error: failed to push some refs to 'https://github.com/Anderson-An/******.git'(已解决)

    提交push 报错: $ git push origin masterTo https://github.com/Anderson-An/******.git ! [rejected] master ...

随机推荐

  1. [Android]Volley源代码分析(叁)Network

    假设各位看官细致看过我之前的文章,实际上Network这块的仅仅是点小功能的补充.我们来看下NetworkDispatcher的核心处理逻辑: <span style="font-si ...

  2. python对象序列化之pickle

    本片文章主要是对pickle官网的阅读记录. The pickle module implements binary protocols for serializing and de-serializ ...

  3. weex-iOS集成

    weex-iOS集成 weex只是刚刚起步,还存在一些bug,有些功能还有待完善和提高.但是其使用起来还是可以节省些时间. 这里我们说说如何把weex集成到我们的iOS项目中 1. 下载weex源代码 ...

  4. PHP学习笔记(14)班级和学生管理---学生

    两个文件夹,一个班级cls,一个学生stu. 两个表,一个班级cls,一个学生stu. 每个文件夹里有7个php文件:主界面stu.php-------增add.php,insert.php----- ...

  5. ECMall 中URL体系的改造思路

    EC系列的产品都已停止更新很久了,但其对中国中小电商企业的影响无疑是巨大的.很多公司,都是直接拿来即改,改了即用. 但他们都有个问题,代码是比较传统的开发模式过来的,尤其ecshop.ECMall系统 ...

  6. C#中的事件介绍

    什么是事件?事件有哪些?怎么用事件? 一.什么是事件? 事件(Event) 基本上说是一个用户操作,如按键.点击.鼠标移动.输入值改变等等,或者是一些出现,如系统生成的通知.应用程序需要在事件发生时响 ...

  7. sql server数据库数据查询成功

    <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding= ...

  8. Enterprise Architect UML建模

    UML建模 前言 UML建模资料已经很多了,有人想用有人不用,有人会用也有人不会用,本文只是作者的一篇UML建模总结,不想去写太细,因为真正的你去用下,去画下就基本都会了.工具毕竟是工具,设计和思想才 ...

  9. Torch-RNN运行过程中的坑 [1](读取Lua非空table,size为0)

    0.踩坑背景 执行Torch-RNN的时候,在LanguageModel.lua中的encode_string函数中,对start_text的各个character进行id映射编码,实现功能类似“北京 ...

  10. CI和CD的意思

    openstack中CI和CD的意思: 持续集成(CI)和持续交付(CD)