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
相关推荐
xlq223221 小时前
3.git
git
一只大袋鼠13 小时前
Git 进阶(二):分支管理、暂存栈、远程仓库与多人协作
java·开发语言·git
我叫张小白。20 小时前
Git 分支管理与团队协作
git
DogDaoDao21 小时前
Windows 下 Git 报错:`touch` 无法识别 —— 原因分析与 7 种解决方案(从入门到精通)
windows·git·程序员·npm·powershell·cmd·touch
caicai_xiaobai1 天前
Ubuntu上Git安装步骤
linux·git·ubuntu
come112341 天前
git 区分是 Git 分支还是 worktree 路径名
git
憧憬成为java架构高手的小白1 天前
git多人工作之个人规范使用【ai+个人理解】
git
CVer儿1 天前
git简单操作
git
Andya_net1 天前
Git | Git 核心命令深入解析:从原理到实战
大数据·git·elasticsearch
wh_xia_jun1 天前
给小白的 Maven 命令行执行测试 完整指南
git·maven·intellij-idea