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之前需要了解一些关于数据库的概念: 数据库(database):是一个以某种有组织的方式存储的数据集合.存储数据的仓库,不过是以一定的组织方式进行存储. DBMS:数据库管理系统.经常遇到 ...

  2. 关于.net core 中的signalR组件的使用

    SignalR是为了提供更方便的web交互响应式到推送式的解决方案.有了它之后可以实现客户端直接调用服务端的方法并且获得返回值 (客户端可以是各种平台,目前SignalR支持的语言版本有C#.java ...

  3. C#采集UVC摄像头画面并支持旋转和分辨率切换

    在项目中,我们会需要控制uvc摄像头,采集其实时画面,或者对其进行旋转.目前市面上大多数USB摄像头都支持UVC协议.那么如何采集呢?当然是采用SharpCamera!因为SharpCamera支持对 ...

  4. .NET中的泛型概述

    什么是泛型? 泛型是具有占位符(类型参数)的类.结构.接口和方法,这些占位符是类.结构.接口和方法所存储或使用的一个或多个类型的占位符.泛型集合类可以将类型形参用作其存储的对象类型的占位符:类型形参呈 ...

  5. Eclipse集成Git做团队开发:代码管理

    在日常开发工作中,我们通常使用版本控制软件管理团队的源代码,常用的SVN.Git.与SVN相比,Git有分支的概念,可以从主分支创建开发分支,在开发分支测试没有问题之后,再合并到主分支上去,从而避免了 ...

  6. Java自学-操作符 逻辑操作符

    Java的逻辑运算符 逻辑运算符 示例 1 : 长路与 和 短路与 无论长路与还是短路与 两边的运算单元都是布尔值 都为真时,才为真 任意为假,就为假 区别: 长路与 两侧,都会被运算 短路与 只要第 ...

  7. English--定语从句

    English|定语从句 从介绍从句开始,英语的句子已经开始逐渐复杂了!做好心理准备,三大从句介绍完毕,会介绍分词短语.废话不多说,直接开始干! 前言 目前所有的文章思想格式都是:知识+情感. 知识: ...

  8. 设计模式之(六)原型模式(ProtoType)

    认识原型模式 原型模式是比较简单的设计模式.废话不多说,直接看定义:用原型实例指定创建对象的种类,并通过拷贝这些原型创建新的对象.通过实例指定种类,种类就是初始化的类,然后通过拷贝创建对象.先展示一个 ...

  9. java实现SAP BO登录

    最近一个项目用到了SAP的businessObjects,需要进行二次开发,今天开发了登录接口,遇到了一些问题,进行了解决,现在分享一下. 1.依赖jar包的添加 bo登录需要用到一些jar包,具体在 ...

  10. 面试题:栈的push和pop序列是否一致

    参数是两个数组,arr1,arr2 stack stack = new Stack() for(int i=0;j=0;i<arr1.length;i++){ stack.push(arr[i] ...