Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git "stucked" branch

I'm having problem pushing my branch to the remote repository. Git returns me an error: error: dst refspec refs/heads/XXX matches more than one. When I run git ls-remote it only shows me one XXX branch though! (I've tried to delete the branch using git push origin :refs/heads/XXX as well with the same result)

We've faced this issue more than once in more than one Git repositories. What we did previously was to clone the repositories and the "stucked" branch was gone from the cloned repositories.

I'm wondering if there is any alternative solutions to solve this issue without have to resort to re-clone the repository. Git version is 1.7.XX.

Thanks!

like image 762
user2507946 Avatar asked Apr 10 '14 12:04

user2507946


1 Answers

As described in this blog post, make sure you don't have a tag with the same name as your branch.
If that is the case, you can delete it in the upstream repo:

git push origin :refs/tags/XXX 

The alternative, described in answer, is to push the branch explicitly (refspec set for both source and destination)

git push origin refs/heads/XXX:refs/heads/XXX
like image 92
VonC Avatar answered Sep 22 '22 16:09

VonC