git push遇到failed to push some refs to 问题解决

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/nongminkouhao/article/details/86625299

阿里code新建项目,本地第一次git提交遇到的问题

11:27:15.331: [CardIssuing] git -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/master:master
To https://code.aliyun.com/**/**.git
!	refs/heads/master:refs/heads/master	[rejected] (non-fast-forward)
Done
error: failed to push some refs to 'https://code.aliyun.com/**/**.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

原因
远程仓库中有readme或者其他文件,本地没有同步,导致push失败;如log中提示的 ‘Updates were rejected because the tip of your current branch is behind’
解决办法
git pull --rebase origin master
截图记录
然后重新push就可以成功了

另外也可以根据android studio 中VersionControl中console日志提示来
git push --help 进入git帮助文档中查看
帮助文档

参考:这里解释的很形象

猜你喜欢

转载自blog.csdn.net/nongminkouhao/article/details/86625299