git push local branch with same name as remote tag

前端 未结 7 1754
星月不相逢
星月不相逢 2020-12-12 13:36

I\'m trying to push a new local branch product-0.2 to remote where there is already a tag with the same name (but the branch itself does not exist)



        
7条回答
  •  执念已碎
    2020-12-12 13:51

    I was trying to push to a canonical repository this morning and got the following error:

    $ git push origin master
    error: src refspec master matches more than one.
    error: failed to push some refs to 'ssh://user@host/srv/git/repo'
    

    This happened because I had accidentally created a master tag locally:

    $ git tag
    master
    tag1
    tag2
    tag3
    tag4
    

    Once I deleted this tag locally:

    git tag -d master
    

    I was able to push again.

提交回复
热议问题