当前位置:   article > 正文

使用 git 将本地文件上传到 gitee 远程仓库中,推送失败_gitee推送失败

gitee推送失败

项目场景:

背景:

使用 git 想要push 本地文件 到 另一个远程仓库,执行 git push origin master后此时报错


问题描述

问题:
git push 本地文件 到 另一个远程仓库时,运行 git push origin master ,push文件失败,命令框出现以下提示信息:

$ git push origin master

! [rejected]        master -> master (non-fast-forward) error: failed to push some refs to 'https://gitee.com/......git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate
  • 1

在这里插入图片描述


原因分析:

分析:

根据错误信息的提示,我们尝试推送到远程仓库时,发现我们当前分支与远程分支的提交记录并不一致。
原因: 这通常是由于其他人在我们之前已经对远程仓库进行了更改所导致该次推送失败。
在这里插入图片描述


解决方案:

解决方法:

1、git pull origin master --allow-unrelated-histories //把远程仓库和本地同步,消除差异

2、重新 git add .

3、commit相应文件

4、git push origin master 推送文件

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/运维做开发/article/detail/770463
推荐阅读
相关标签
  

闽ICP备14008679号