试图将更改推送到 GitHub,但是远程仓库已经包含了您本地没有的工作(可能是其他人提交的修改)

这通常是由于其他人或其他仓库推送到了相同的分支上,导致您的本地仓库和远程仓库之间存在冲突。

错误信息:

To github.com:8upersaiyan/CKmuduo.git ! [rejected] main -> main (fetch first) error: failed to push some refs to 'github.com:8upersaiyan/CKmuduo.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

解决方法:

git config --global pull.rebase true # 设置默认为变基策略
git pull origin main #从远程同步到本地

解决完远程同步到本地的问题,在解决从本地到网络的同步:

使用:

git add .
git commit -m "解决冲突并更新"
git push origin main

把本地的修改推送到网络上。

相关推荐
ALex_zry4 小时前
Git大型仓库推送失败问题解决方案:大文件传输优化指南
git
草莓熊Lotso4 小时前
Git 分支管理:从基础操作到协作流程(本地篇)
大数据·服务器·开发语言·c++·人工智能·git·sql
w***Q3507 小时前
Git工作流自动化
运维·git·自动化
舒一笑12 小时前
GitPulse:让代码的故事自己讲述
git·程序员·intellij idea
5***o50013 小时前
Git在代码中的GitHub
git·github
还是会想她14 小时前
git 常见命令
git
1***y17816 小时前
Git在发布流程中的自动化标签
运维·git·自动化
逻辑棱镜1 天前
Git 分支管理与提交信息规范 (v1.0)
git·github·团队开发·代码规范·敏捷流程
悦悦欧呐呐呐呐1 天前
git 设置邮箱和用户名
git
正经教主1 天前
【Git】Git06:Git 管理 Android 项目教程(含GitHub)
android·git