社区所有版块导航
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 push 提交出现 failed to push some refs to

Haotian_W • 5 年前 • 217 次点击  

问题描述

$ git push -u origin master

error: failed to push some refs to 'codechina.csdn.net:BAR_WORKSHOP/topopt-in-matlab.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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

原因

github中的README.md文件不在本地目录中。

解决方法

git pull --rebase origin master
  • 1
  • 1

先运行上面这条命令,可以看到本地目录中多了README.md文件,这时候再push就不会出错了。

git push -u origin master
  • 1
  • 1
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/73463