项目上传 GitHub 释疑

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即可。

最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Lesson 3: Using GitHub to Collaborate 3.1 Creating a GitH...
    赤乐君阅读 6,442评论 3赞 11
  • 考上北京电影学院两年了,两年来,每天都按部就班的上课,下课,学习,排练,表演,我们班有48个学生,其中好几个女同学...
    墨鱼卷阅读 240评论 0赞 0
  • 肥宅很喜欢听音乐,有一天他在湖边一边听音乐一边踩单车,听得正嗨,一不小心旁边有个人穿过,肥宅一个刹车,结果自己用了...
    jiajun_geek阅读 498评论 0赞 3

友情链接更多精彩内容