Updates were rejected because the tip of your current branch is behind

Git在push推送时,报错提示信息如下:

bash 复制代码
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. If you want to integrate the remote changes,
hint: use 'git pull' before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

原因分析:

是由于本地和远程仓库两者代码文件不同步,因此需要先pull,进行合并然后再进行push

解决方法:

1、先使用pull命令:

复制代码
git pull --rebase origin master

2、再使用push命令

复制代码
git push -u origin maste
相关推荐
自动花钱机7 小时前
Cherry-pick冲突与Git回滚
git
coderklaus12 小时前
git rebase
git
苏元12 小时前
☠️ 写错 commit = 绩效自爆,别说我没提醒你!
git
程序设计实验室13 小时前
模型文件硬塞进 Git,GitHub 直接打回原形:使用Git-LFS管理大文件
git
Dontla1 天前
脚本:git push直到成功(windows powershell命令)(Github连不上、Github断开)
git·github
CAE虚拟与现实1 天前
GitHub Desktop 和 Git 命令行工具(CLI)各有优势
git·github·github desktop
RePeaT1 天前
代码双仓库备份指南:三种简单高效的方法
git·github
coderklaus1 天前
Git GC
git
xiezhr2 天前
Git提交错了,别慌!还有后悔药
git·gitlab·github
GGGGGGGGGGGGGG.2 天前
CI/CD 全链路实践:从 Git 基础到 Jenkins + GitLab 企业级部署
运维·git·ci/cd·云原生·gitlab·jenkins