[Solved] git Error: error: dst refspec v0.10.2 matches more than one

Problem description

If the tag and heads have the same name, an error will be reported

error: dst refspec v0. 10.2 matches more than one

Problem analysis

refs/heads/* is the branch name refs/tags/* is the tag name refs/remotes/* is the remote track name

When naming heads, it generally uses main, master, that is refs/heads/Master, refs/heads/main
when naming tags, it usually uses v0.1, v0. 2, i.e. refs/tags/v1.0

When you execute git push origin master, because Master is generally only in heads, not in tags, GIT can directly find the branch you want to push.

But here:

git LS remote the results are as follows:

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

Twice v0.10.2 , corresponding to tags and heads respectively, so an error is reported.

Solution:

    1. change the name of the branch’s heads or tags (the change method is Google). Push

git push origin refs/heads/Main: refs/tags/V1 with the full name of the branch 2 

Reference resources:

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

Read More: