在线咨询
QQ咨询
服务热线
服务热线:0573-87802092 18857388186
TOP

Git提交到GitHub报错:Updates were rejected because the remote contains work that you do not have locally

发布于 : 2019-10-29 10:03:10 浏览:0

    

在使用Git将本地项目上传到GitHub上时,键入命令:

git push -u origin master
报错提示:Updates were rejected because the remote contains work that you do not have locally,This is usually caused by another repository pushing to the same ref. You may want to first integrate the remote changes (e.g., ‘git pull …’) before pushing again.

究其原因,是因为本宝宝在GitHub上创建远程仓库时,勾选了 Initialize this repository with a README这项,导致远程仓库不为空,解决办法,先将远程仓库的内容合并到本地,然后再上传即可,命令如下:

git pull –rebase origin master
git push -u origin master


TAG