zoukankan      html  css  js  c++  java
  • Git 本地推送远程失败 non-fast-forward


    To github.com:Yee-Q/yeexang-community.git
     ! [rejected]        dev -> dev (non-fast-forward)
    error: failed to push some refs to 'git@github.com:Yee-Q/yeexang-community.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.
    

    错误提示如上,本地项目向远程推送时,提示远程 non-fast-forward,即时本地比远程领先,推送前必须先合并,Git 也给出提示了,要我们先 git pull


    There is no tracking information for the current branch

    这是因为没有指定本地分支与远程分支的关联,可以使用

    git pull origin dev
    

    如果希望一劳永逸,可以使用

    git branch --set-upstream-to=origin/dev
    

    fatal: refusing to merge unrelated histories

    执行 pull 操作时,如果出现这个错误,是由于本地仓库和远程仓库有不同的开始点,也就是两个仓库没有共同的 commit 点而出现的无法提交。这里我们需要用到 --allow-unrelated-histories,也就是我们的 pull 命令改为下面这样的:

    git pull --allow-unrelated-histories
    

    fix conflicts and then commit the result

    pull 操作会自动进行合并,但产生了冲突。一般会有提示是哪个文件产生冲突,找到对应的文件进行修改,再提交一次就行了


  • 相关阅读:
    三方登录微博url接口
    微博三方登录流程 (原理)
    celery配置与基本使用
    spring 验证框架
    IDEA 插件整理
    spring security笔记 默认登陆页面源码
    EXTJS7 自定义日期时间选择输入框
    EXTJS7 combobox本地模式 动态修改选项
    EXTJS7 combobox 下拉加载数据源码
    nginx 反向代理端口号丢失处理
  • 原文地址:https://www.cnblogs.com/Yee-Q/p/13769902.html
Copyright © 2011-2022 走看看