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

21 篇文章 0 订阅

阿里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帮助文档中查看
帮助文档

参考:这里解释的很形象

  • 3
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值