error: failed to push some refs to 'https://gitee.com/*.git' hint: Updates were rejected because the remote contains work that you do

 

 原因:本地库和远程库的内容不一致,我的是由于新建远程库的时候添加了点内容,导致idea无法将项目push到远端,首次push项目到远端仓库时,一定要保证新建仓库为空!!!

解决办法:在hint中也有提示把远程库同步到本地库就可以了,命令:git  pull --rebase origin master,该命令是先将远端库同步到本地,然后再将本地最新的commit提交

posted @ 2022-05-28 21:35  新界王  阅读(708)  评论(0)    收藏  举报