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. 尝试 WebAssembly

    wasm 为浏览器应用开辟了一个全新的领域.意义非凡,并不是一句两句说的清的,今天正好有点空做些实验. 1. emsdk 的安装 Emscripten 可以直接将 C/C++ 编译为 wasm,让用 ...

  2. Kubernetes学习续之一键部署kubeadm

    1.Kubernetes的架构和组件,在部署时,它的每一个组件都是一个需要被执行的.单独的二进制文件,所以不难想象,SaltStack这样的运维工具或由社区维护的脚本的功能,就是要把这些二进制文件传输 ...

  3. docker离线导入导出镜像

    docker save -o mysqlies.tar 5ada6380f248(镜像id)    # 镜像id是要导出的 有镜像的机器  在有镜像的机器上执行docker load --input ...

  4. C#读写设置修改调整UVC摄像头画面-曝光

    有时,我们需要在C#代码中对摄像头的曝光进行读和写,并立即生效.如何实现呢? 建立基于SharpCamera的项目 首先,请根据之前的一篇博文 点击这里 中的说明,建立基于SharpCamera的摄像 ...

  5. Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1

    可以看出是 maven-surefire-plugin:2.18.1 插件问题,在网上寻找解决方案如下: <plugin> <groupId>org.apache.maven. ...

  6. Mysql之视图和事务(五)

    一:视图 1.问题 对于复杂的查询,往往是有多个数据表进行关联查询而得到,如果数据库因为需求等原因发生了改变,为了保证查询出来的数据与之前相同,则需要在多个地方进行修改,维护起来非常麻烦 解决办法:定 ...

  7. Spring怎么管理事务?

    我们一般通过aop管理事务,就是把代码看成一个纵向有序的,然后通过aop管理事务,就好比增删改的时候需要开启一个事务,我们给他配置一个required,required就是有事务就执行事务,没有就给他 ...

  8. 16. Promise对象

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

  9. sizeof()计算

    本节包含sizeof()计算结构体,位域,数组,字符串,指针,c++中的class等类型的大小,sizeof()计算的大小都是以字节为单位. 一 计算基本类型的长度 sizeof(char): 1 s ...

  10. 互斥锁的robust属性的介绍和使用

    一个具体的场景:在多线程中,当一个线程获得锁之后异常退出后,应该怎么处理? 方案一 使用锁的robust特性 简单地讲,就是当拥有这个锁的线程挂了后,下一个尝试去获得锁的线程会得到EOWNWERDEA ...