本地仓库初始化并关联到GitHub仓库,进行代码的上传,以及相关错误 fatal: refusing to merge unrelated histories 解决方案
2023-09-11 14:22:08 时间
本地仓库初始化并关联到GitHub仓库,进行代码的上传,因本地默认是master分支,远程仓库默认是main分支,可能出现 fatal: refusing to merge unrelated histories 错误。
git init
git checkout -b main
git remote add origin https://
git add .
git commit -m ""
git pull
git push
如果出现两个分支版本不一样,导致冲突进行 pull 、 push 失败,可以通过下面方法进行解决:
git merge master --allow-unrelated-histories
git merge main --allow-unrelated-histories
git pull --allow-unrelated-histories
git pull origin master –allow-unrelated-histories
git pull origin main –allow-unrelated-histories
相关文章
- 如何从Eclipse导入github上的项目源码
- 如何将项目托管到Github上
- github项目记录,一个个试着玩
- Jenkins - 集成GitHub
- [GitHub] 1. Configuring Git
- golang gin数据绑定综合案例:用户注册及自定义数据校验器的应用:github.com/go-playground/validator/v10/translations/zh
- 使用 JavaScript Promise 读取 Github 某用户的数据
- 一个最简单的 Github workflow 例子
- 【Github教程】史上最全github用法:github入门到精通
- 再谈git和github-深入理解-3
- GitHub入门之一:使用github下载项目 .
- github watch star fork
- 在HBuilderX的git上导入github项目/把项目传到github
- fatal: unable to access ‘https://github.com/用户名/项目名.git/‘: OpenSSL SSL_read: Connection was reset, e
- 使用GitHub
- [Git & GitHub] GitHub频繁更新,个人页面 "PRO" 状态等 图标显示