【gitlab】首次提交本次代码到gitlab上,报错:Updates were rejected because the remote contains work that you do

首次提交本次代码到gitlab上,报错:Updates were rejected because the remote contains work that you do

报错情况如下:

 

错误原因:

由于在gitlab上新建空项目时候,勾选了Initialize this repository with a README这项,导致远程仓库不为空

 

 

也就是 此刻的空项目是

 

 

解决方法:

现将远程仓库的内容拉取到本地,然后再进行提交

1.删除gitlab上现有的空项目,新建项目,不要勾选Initialize this repository with a README这项

 

2.再重新push代码到gitlab上

 

 即可成功

posted @ 2019-03-14 11:12  Angel挤一挤  阅读(1304)  评论(1编辑  收藏  举报