美文网首页
项目上传 GitHub 释疑

项目上传 GitHub 释疑

作者: 敲代码的本愿 | 来源:发表于2017-03-03 12:56 被阅读163次

    GitHub 新手指南:创建、提交、合并、删除分支等操作
    Git 命令:比较全面
    超详细教程:文章描述步骤比较详细

    问题###

    1、fatal: refusing to merge unrelated histories

    原因

    "git merge" used to allow merging two branches that have no common 
    base by default, which led to a brand new history of an existing 
    project created and then get pulled by an unsuspecting maintainer,
    which allowed an unnecessary parallel history merged into the existing 
    project.  The command has been taught not to allow this by default, 
    with an escape hatch "--allow-unrelated-histories" option to be used 
    in a rare event that merges histories of two projects that started 
    their lives independently.`
     "git pull" has been taught to pass the "--allow-unrelated-histories" 
    option to underlying "git merge".```
    
    **解决**
    执行命令`git merge gh-pages --allow-unrelated-histories`,再`push`。
    
    **2、
    

    To https://github.com/huang125/RippleView.git
    ! [rejected] master -> master (non-fast-forward)
    error: failed to push some refs to 'https://github.com/huang125/RippleView.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.```**

    分析
    非快进方式的更新被拒绝了,需先从中心仓库pull到最新版本,merge后再push

    原因
    1、github中的README.md文件不在本地代码目录中

    解决
    1、查看本地工程目录是否有README.md文件;
    2、若没有,执行命令git pull --rebase origin master
    3、再查看是否有README.md文件,若有,执行git push -u origin master即可。

    相关文章

      网友评论

          本文标题:项目上传 GitHub 释疑

          本文链接:https://www.haomeiwen.com/subject/rdilgttx.html