git 错误error: failed to push some refs to

error: failed to push some refs to 'XXXX'
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、先拉下来,将两个仓库内容合并

git pull --rebase origin master

2、再上传

git push -u origin master

 

亲测有效。

 

posted @ 2019-12-12 17:07  一粒小米-博客  阅读(2401)  评论(0编辑  收藏  举报