【git】error: dst refspec v0.10.2 matches more than one

问题描述

如果出现tag和heads重名,就会报错

error: dst refspec v0.10.2 matches more than one

问题分析

  • refs/heads/* 是分支名称
  • refs/tags/* 是tag名称
  • refs/remotes/* 是远程track名称

对heads命名时,用的一般是 main,master ,即refs/heads/masterrefs/heads/main
对tags命名时,用的一般是v0.1, v0.2,即refs/tags/v1.0

当你用执行git push origin master时,由于master一般只在heads,不在tags中,所以git就直接能找到你要推送的分支。

但是这里:

git ls-remote结果如下:

61d10100326130d2eceee85167d5ec2d9970ebbe        refs/heads/seq_task
4ee9724f3a6a47134483e4955c688f4f34432ee0        refs/heads/simulastsharedtask
83e615d66905b8ca7483122a37da1a85f13f4b8e        refs/heads/v0.10.2
bdf09e1321a77252835550e84d73ad1bb3f3173c        refs/heads/xlmr_benchmark
3e5a2739bce92b2516d060959a1aa3dd51d221dc        refs/tags/v0.10.0
8a0b56efeecba6941c1c0e81a3b86f0a219e6653        refs/tags/v0.10.1
83e615d66905b8ca7483122a37da1a85f13f4b8e        refs/tags/v0.10.2

出现了两次v0.10.2,分别对应tags和heads,所以报错。

解决方法

  1. 更改分支的heads或者tags名称(更改方法自行Google)
  2. 用分支全称来推送git push origin refs/heads/main:refs/tags/v1.2

参考

https://stackoverflow.com/questions/70584317/git-push-error-dst-refspec-refs-heads-main-matches-more-than-one

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值