社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Git

Git 更新推送远程库报错:failed to push some refs to ‘XXXX.git‘

王佳斌 • 4 年前 • 382 次点击  

前言

注意:不是首次提交到远程仓库(Gitee码云),可当作我是更新代码需求。

当我改完代码并提交到本地仓库后,执行 git push 推送更新到远程仓库时,直接报错。

完整报错

在这里插入图片描述

# 注意:远程库地址是我的(你的肯定和我不一样)
# git@gitee.com:wangjiabin-x/applets.git

To gitee.com:wangjiabin-x/applets.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@gitee.com:wangjiabin-x/applets.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.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

直接翻译英文:

到gitee.com网站:王家斌-x/小程序.git 
! [拒绝]主机->主机(先获取)
错误:无法将某些引用推送到'git@gitee.com:王家斌-x/小程序.git' 
提示:更新被拒绝,因为远程包含您所做的工作 
提示:本地没有。这通常是由另一个存储库推送引起的 
提示:对于同一个ref。您可能需要首先集成远程更改 
提示:(例如,“git pull…”)然后再推。
提示:有关详细信息,请参阅“git push--help”中的“关于快速前进的说明”。 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

解决

直接按照提示,键入以下命令(请注意分支):

git pull --rebase origin master 
  • 1

然后再正常提交:

git push
  • 1

成功:
在这里插入图片描述

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/71888
 
382 次点击