DEV Community

Andreas Bergström
Andreas Bergström

Posted on • Edited on • Originally published at andreasbergstrom.dev

error: src refspec refs/heads/foo matches more than one

If git push ever fails with error: src refspec refs/heads/foo matches more than one, the cause is almost always a tag and a branch sharing the same name. Git can't tell which ref you meant, so it refuses to resolve the push. Run git tag to spot the duplicate, delete the offending tag with git tag -d <name>, and the push goes through.

The full post has the exact commands plus a small habit worth keeping: never reuse names between tags and branches. Both Git itself and most GUI clients trip over the ambiguity, and the few seconds saved up front cost a lot more later.


Originally published at andreasbergstrom.dev — read the full post there.

Top comments (0)