试图将更改推送到 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

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

相关推荐
码厂一粒沙4 小时前
【代码管理】git使用指南(新手向)
git
李贺梖梖12 小时前
Git初识
git
~央千澈~12 小时前
git大文件储存机制是什么-为什么有大文件会出错并且处理大文件非常麻烦-优雅草卓伊凡
git
Komorebi_999914 小时前
Git 常用命令完整指南
大数据·git·elasticsearch
stark张宇15 小时前
Git 与 GitHub 协同工作流:从0到1搭建版本控制体系
git·gitlab·github
爱吃生蚝的于勒16 小时前
【Linux】零基础学会Linux之权限
linux·运维·服务器·数据结构·git·算法·github
minji...16 小时前
Linux相关工具vim/gcc/g++/gdb/cgdb的使用详解
linux·运维·服务器·c++·git·自动化·vim
Arva .1 天前
开发准备之日志 git
spring boot·git·后端
奇某人1 天前
【嵌入式】【GIT】终端中文乱码修复
git
可爱的蜗牛牛1 天前
上传本地git所有历史记录到已有远程仓库
git