今天对代码进行了修改优化,然后往往远程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. erlang四大behaviour之一gen_server(转载)

    erlang程序设计里面有个设计原则就是把你的进程构造成树,把共用代码提出来,特定功能用自己的module实现,这也就是behaviour了,应用behaviour可以减少与本身事务无关的代码量,设计 ...

  2. 李洪强和你一起学习前端之(1)Html基础

     1 快捷键的认识(虽然我用的是MAC,但是这里以windows快捷键来讲,但是MAC电脑可以把Ctrl换成command试试)   Ctrl + c 复制 Ctrl + v 粘贴 Ctrl + a ...

  3. target="_blank" 导致的钓鱼攻击

    挺久的漏洞,之前没仔细看现在看了下 直接构建实验环境: test1.html: <!DOCTYPE html> <html> <head> <meta cha ...

  4. cocos2d-x 输入框CCEditBox的使用

    特别说明: 这个版本的CCEditBox,设计有缺陷,背景图片的位置与输入区域的位置不同步,需要自己修改原来的代码,自己加上输入区域的坐标偏移量. void CCEditBox::setPositio ...

  5. push images to private repostory

    1.从官网pull 所需要的基础镜像 docker pull microsoft/mssql-server-windows-express 2.打上私有仓库标签 docker tag microsof ...

  6. shell课后总结

      shell课后总结   作者:高波 归档:学习笔记 2017年12月4日13:31:08 快捷键: Ctrl + 1 标题1 Ctrl + 2 标题2 Ctrl + 3 标题3 Ctrl + 4 ...

  7. Iptables详解+实例

    Iptabels是与Linux内核集成的包过滤防火墙系统,几乎所有的linux发行版本都会包含Iptables的功能.如果 Linux 系统连接到因特网或 LAN.服务器或连接 LAN 和因特网的代理 ...

  8. mysql 分数表实现排名

    首先初始化一张表 DROP TABLE IF EXISTS `lq_wx_sign`; CREATE TABLE `lq_wx_sign` ( `id` ) unsigned NOT NULL AUT ...

  9. 第一百五十六节,封装库--JavaScript,延迟加载

    封装库--JavaScript,延迟加载 延迟加载的好处,就是在浏览器视窗外的图片,不加载,拖动鼠标到浏览器视窗内后加载,用户不看的图片就不用加载,可以减少服务器大量流量 将图片的src地址用一张统一 ...

  10. 【vijos】1881 闪烁的繁星(线段树+特殊的技巧)

    https://vijos.org/p/1881 这场比赛太难了sad.所以我都没做.. 这题一开始我竟然不会sad(本来就不会),然后我继续yy..yy了好久,竟然yy了个什么可拆分的并查集?(sa ...