最近本地一个flutter项目因为当时使用可视化创建的时候出了一些问题,但是起初没有注意,后来因为需要新增一个语音插件,需要修改原生android MainActivity.java,才发现这个目录根本不存在,于是重新创建一个项目将原来那个项目文件拷入,等修改好后再使用git 连接原来那个项目的github仓库进行代码推送,发现老是提示如下错误


  1. $ git push -u origin master
  2. To https://github.com/dengxiaoning/flutter-trip.git
  3. ! [rejected] master -> master (non-fast-forward)
  4. error: failed to push some refs to 'https://github.com/dengxiaoning/flutter-trip.git'
  5. hint: Updates were rejected because the tip of your current branch is behind
  6. hint: its remote counterpart. Integrate the remote changes (e.g.
  7. hint: 'git pull ...') before pushing again.
  8. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

然后又使用pull 仓库代码拉取合并,但是推送任然失败,看有朋友说需要 增加 -f 进行强制拉取,但是试过也没用,最后反过来想来过强制推送看得行不


  1. $ git push -f origin master
  2. Counting objects: 173, done.
  3. Delta compression using up to 4 threads.
  4. Compressing objects: 100% (130/130), done.
  5. Writing objects: 100% (173/173), 1.66 MiB | 5.73 MiB/s, done.
  6. Total 173 (delta 9), reused 38 (delta 4)
  7. remote: Resolving deltas: 100% (9/9), done.
  8. To https://github.com/dengxiaoning/flutter-trip.git
  9. + d137bd8...0208d12 master -> master (forced update)

一试咦还OK了,不错记录记录。

【注意】在协调时慎用,该参数-f会使用本地项目完全替换掉原仓库的项目,如果本地项目不能保证比远程仓库的完整切勿使用,否则追悔莫及

看看官方介绍


  1. -f--force
  2. Usually, the command refuses to update a remote ref that is not an ancestor of the local ref used to overwrite it. Also, when --force-with-lease option is used, the command refuses to update a remote ref whose current value does not match what is expected.
  3. This flag disables these checks, and can cause the remote repository to lose commits; use it with care.
  4. Note that --force applies to all the refs that are pushed, hence using it with push.default set to matching or with multiple push destinations configured with remote.*.push may overwrite refs other than the current branch (including local refs that are strictly behind their remote counterpart). To force a push to only one branch, use a + in front of the refspec to push (e.g git push origin +master to force a push to the master branch). See the <refspec>... section above for details.

Updates were rejected because the tip of your current branch is behind的更多相关文章

  1. (转)Updates were rejected because the tip of your current branch is behind

    刚创建的github版本库,在push代码时出错: $ git push -u origin masterTo git@github.com:******/Demo.git ! [rejected] ...

  2. 01_第一次如何上传GitHub(转)Updates were rejected because the tip of your current branch is behind

    https://www.cnblogs.com/code-changeworld/p/4779145.html 刚创建的github版本库,在push代码时出错: $ git push -u orig ...

  3. [git] Updates were rejected because the tip of your current branch is behind its remote counterpart.

    场景 $ git push To https://github.com/XXX/XXX ! [rejected] dev -> dev (non-fast-forward) error: fai ...

  4. Git 报错:Updates were rejected because the tip of your current branch is behind

    刚开始学习 git 命令,发现会出现很多的错误,所以就总结下出现的错误,以此来加深理解和掌握吧! 环境:在本地库操作了一系列的 add 和 commit 操作后,想把本地仓库推送到远端,但是发生以下错 ...

  5. 【git报错】hint: Updates were rejected because the tip of your current branch is behind

    有时候作为非master权限的项目参与者 在push的时候会遇到这样的报错: hint: Updates were rejected because the tip of your current b ...

  6. git push时报错:Updates were rejected because the tip of your current branch is behind

    出现这样的问题是由于:自己当前版本低于远程仓库版本 有如下几种解决方法: 1.使用强制push的方法: git push -u origin master -f 这样会使远程修改丢失,一般是不可取的, ...

  7. Updates were rejected because the tip of your current branch is behind 问题出现解决方案

    提供如下几种方式: 1.使用强制push的方法(多人协作时不可取): git push -u origin master -f 2.push前先将远程repository修改pull下来 git pu ...

  8. git提交报错:Updates were rejected because the tip of your current branch is behind

    提交代码push时报错:上网查询了一下解决办法有很多种,1.使用强制push的方法:(上网查询说这种会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候.) git push -u origin ...

  9. git提交时报错:Updates were rejected because the tip of your current branch is behind

    有如下3种解决方法: 1.使用强制push的方法:git push -u origin master -f这样会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候. 2.push前先将远程rep ...

  10. git push ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/Operater9/guest' hint: Updates were rejected because the tip of your current bra

    推送本地代码到github报错 git push报错 ! [rejected] master -> master (non-fast-forward) error: failed to push ...

随机推荐

  1. 服务器资源监测脚本(网卡、MEM、CPU)

    #-*- coding: utf-8 -*- #!/usr/bin/python ''' 用法: sar [ 选项 ] [ <时间间隔> [ <次数> ] ] 主选项和报告: ...

  2. 小知识:SQL Monitor Report的使用

    在上一篇 优化利器In-Memory开启和效果 中,提到的两个SQL对比,使用的是传统的dbms_xplan.display_cursor方式来查看执行计划,好处是文本输出的通用性强,基本信息也都有. ...

  3. 你可能需要的 6 个 React 开发小技巧

    ​ 这是一个可怕的问题,在React中,我们经常会编写条件语句来显示不同的视图,比如这个简单的例子. const App = () => { return ( <> { loadin ...

  4. js函数防抖节流

    // 3.1 函数防抖: // 当持续触发事件时,一定时间段内没有再次触发事件,事件处理函数才会执行一次,如果设定时间到来之前,又触发了事件,就重新开始延时.// 也就是说当一个用户一直触发这个函数, ...

  5. Vue 路由导航守卫

    Vue 路由导航守卫 一:全局守卫 (1) router.beforeEach beforeEach((to, from, next) => {}) 接收三个参数,在路由切换成功之前调用 to ...

  6. 移动端网页--better-scroll介绍

    移动端网页--better-scroll介绍 Options 起始位置及滚动方向 startX:0 开始时的X轴位置 startY:0 开始时的Y轴位置 scrollY: true 滚动方向为 Y 轴 ...

  7. Cesium案例(八) Terrain

    第一步正常建viewer,需要注意的是官网例子属性值比较老,最新版本的属性值有所差异,全copy官网会无法运行,提示函数未定义. 第一处差异 官网: 1 const viewer = new Cesi ...

  8. windows如何拉取一个文件夹下的所有文件名

    问题描述:遇到一个问题,是说一个文件夹下的文件太多了,如何去批量的拉去文件名呢,今天用CMD+DIR的方式拉取 1.文件目录也很深,就从文件导航栏进入CMD窗口 2.在当前目录中输入cmd,然后回车 ...

  9. NextCloud 在lnmp下 nginx 的配置

    server { listen 80; listen [::]:80; server_name lnmp.org www.lnmp.org; root /home/wwwroot/nextcloud; ...

  10. YII2.0使用ActiveForm表单

    Controller控制器层代码 <?php namespace frontend\controllers; use frontend\models\UserForm; class UserCo ...