I was very happy today to be updating my PayPal for WooCommerce plugin when I ran into a tagging issue. I was able to successfully create my local tag…
git tag -a v1.0.3 -m "Version 1.0.3 update"
I then tried to push this tag to my remote repo and wound up with the following error.
git push origin v1.0.3 error: src refspec v1.0.3 matches more than one. error: failed to push some refs to 'https://github.com/angelleye/paypal-woocommerce.git'
So what’s the first thing we do in this situation? Google! Right away I found a bunch of articles covering this topic, however, they were all saying the same thing, which was that at some point they had accidentally created a tag on their local repo called “master” and that’s what was causing their issue when trying to push a new tag to their remote master. Once they deleted that local master tag the problem went away.
Ok, great. Unfortunately, though, when I checked my tags I did not see any master tag, or anything at all I wouldn’t expect to see.
git tag v1.0 v1.0.1 v1.0.2 v1.0.3
The very early stages of panic mode suddenly kick in as Google isn’t giving me my immediate answer, however, a quick run through my .git directory in my local repo revealed the issue. When I took a look in /.git/refs/heads/ I realized I had a branch that was called v1.0.3. I had already merged that branch into my master, though, so I simply deleted that branch and I was then able to push my new tag to my remote without an issue.
I’m new to Git, myself, but I’m assuming that there must be some way to specify that you want to push a tag versus a branch, and if you don’t do that it sees both and winds up throwing that error about having more than one. I did indeed have more than one local “thing” with the same name, so Git apparently wasn’t sure which one I was talking about.
The point is, if you get this error you just need to look at your tags and your branches to see if anything is the same or out of the ordinary. Clean that up and you’ll be golden!