Administrator@SC- MINGW64 /e/gitrepository (master)
$ git push django master
To github.com:zgc137/django.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:zgc137/django.git'
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.

此时很多人会尝试下面的命令把当前分支代码上传到master分支上。

$ git push -u origin master

但依然没能解决问题

出现错误的主要原因是github中的README.md文件不在本地代码目录中

origin是自己在git上创建的仓库名字,我的创建的名字是django

可以通过如下命令进行代码合并【注:pull=fetch+merge]---取+合并

git pull --rebase origin master

注:上传代码到远程库,上传之前最好先Pull一下,再执行命令: git pull origin master

$ git pull --rebase django master
Warning: Permanently added the RSA host key for IP address '52.74.223.119' to the list of known hosts.
From github.com:zgc137/django
* branch master -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: wrote a readme file
Applying: 天天生鲜项目+练习

即pull成功,

接着执行:git push origin master

$ git push -u django master
Enumerating objects: , done.
Counting objects: % (/), done.
Delta compression using up to threads
Compressing objects: % (/), done.
Writing objects: % (/), 1.44 MiB | 782.00 KiB/s, done.
Total (delta ), reused (delta )
remote: Resolving deltas: % (/), done.
To github.com:zgc137/django.git
eecd635..07115e0 master -> master
Branch 'master' set up to track remote branch 'master' from 'django'.

git 提交代码报错failed to push some refs to 解决笔记的更多相关文章

  1. git提交代码报错 trailing whitespace的解决方法

    1. git提交代码报错 trailing whitespace 禁止执行pre-commit脚本 进入到项目目录中 chmod a-x .git/hooks/pre-commit 2.git提交代码 ...

  2. Git提交代码报错Git push error:src refspec XXX matches more than one解决方案

    Git提交代码push时,报错这个 error: src refspec master matches more than one. error: failed to push some refs t ...

  3. git push 报错:failed to push some refs to 'git@git.xxxx:devops/thor.git'

    error: failed to push some refs to 'git@git.caicaivip.com:devops/thor.git' hint: Updates were reject ...

  4. git报错failed to push some refs to 'git@github.com:Markprint/github.git'

     这个不知名小错误用了我两天的空余时间mmp   就是这里报的错 输入 git push origin master -f 解释为: 远程分支上存在本地分支中不存在的提交,往往是多人协作开发过程中遇到 ...

  5. git提交代码报:fatal: Unable to create 'E:/testGit/test/.git/index.lock': File exists.

    git提交代码报错,提示:fatal: Unable to create 'E:/testGit/test/.git/index.lock': File exists. 具体截图如下: 在.git目录 ...

  6. svn 提交代码报错

    svn 提交代码报错 最近新安装了TortoiseSvn 1.92,在上传代码,其中有新增加的文件,出现如下错误: 解决方法: 1.用vs生成patch文件 2.生成的patch文件中讲nonexis ...

  7. 提交代码报错 error: failed to push some refs to

    在本人想把本地的分支推送到远程仓库时,突然出现了错误提醒error: failed to push some refs to....心里一咯噔,推不上去这还得了,手比脑快地就去google了一下. 然 ...

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

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

  9. Git错误:error:failed to push some refs to 'git@gitee.com:name/project.git'

    大家在通过本地仓库上传文件到远程仓库时,会报出 error:failed to push some refs to 'git@gitee.com:name/project.git' 的错误. 解决方法 ...

随机推荐

  1. sql 语句中定义的变量不能和 sql关键字冲突

    sql 语句中定义的变量不能和 sql关键字冲突 from bs_email_account account LEFT JOIN bs_group_info gp ON account.group_i ...

  2. Linux(二)各种实用命令

    继续Linux命令学习,没有什么捷径,每个命令都去敲几遍就熟悉了,第二篇学习的是一些比较实用类的命令,主要是从开发的角度进行学习,并不深入,话不多说,开始! 一.系统管理类 1.1 stat --st ...

  3. Android开发DDMS找不到Emulator Control的方法

    1.右键DDMS,点击reset. 2.window->show view->other->android->Emulator Control

  4. 树莓派Raspbian系统密码

    树莓派Raspbian系统密码 树莓派Raspbian系统默认登录用户名为pi,该账户默认密码是raspberry(可在raspi-config中修改). 树莓派的Raspbian系统root用户默认 ...

  5. MTSC2019-深圳站 议题征集

    议题截止时间 11月初 议题投递地址 topic@testerhome.com   臣一路走来,没有敌人,看见的都是朋友和师长 —司马懿 关于中国移动互联网测试大会 MTSC 大会(中国移动互联网测试 ...

  6. Spring MVC异常友好展示

    官网 https://docs.spring.io/spring/docs/4.3.25.RELEASE/spring-framework-reference/htmlsingle/ Springmv ...

  7. ASP.NET CORE 中使用AutoMapper进行对象映射

    ASP.NET CORE 中使用AutoMapper进行对象映射 1.什么是AutoMapper? AutoMapper是基于对象到对象约定的映射工具,常用于(但并不仅限制于)把复杂的对象模型转为DT ...

  8. 16. Promise对象

    目录 Promise对象 一.含义 1. Promise是什么 2. 实例讨论 二.Promise特性案例解析 1. Promise的立即执行性 2. promise的三种状态 3. Promise的 ...

  9. 解决bootstrap模态框居中问题

    完美解决办法: 在bootstrap.js或bootstrap.min.js文件中找到Modal.prototype.show方法. 在that.$element.addClass('in').att ...

  10. Python之路(第四十三篇)线程的生命周期、全局解释器锁

    一.线程的生命周期(新建.就绪.运行.阻塞和死亡) 当线程被创建并启动以后,它既不是一启动就进入执行状态的,也不是一直处于执行状态的,在线程的生命周期中,它要经过新建(new).就绪(Ready).运 ...