You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
在用git push 代码时遇到了error: src refspec XXX matches more than one 这样的错误, 然后google找到一个解决方案
两种情况
第一种情况,删除远程branch时遇到这种情况的解决方法:
git push origin : 3.0
提示 error: src 3.0 XXX matches more than one
error: failed to push some refs to '[email protected]:congzhi/xxxxxxshboard.git' 出现这个错误的原因是在服务器上有个tag的分支是3.0这个名有个branch的分支也是这个名, 也就是说tag分支和branch分支同名了,在执行 git push origin :3.0这个命令时不知道是删除那个 所以会提示错误
将testtag这个tag分支为例,将tag分支push到服务器
git push origin testtag 提示: error: src refspec XXX matches more than one error: failed to push some refs to 'git@xxx:android/text.git'
出现这个错误主要是因为本地也有个branch的分支名为testtag,这样在push时不知道是将branch的分支push到服务器还是将tag的分支push到服务器,如果是将tag分支push到服务器,那就将branch的分支删掉,如果是将branch的分支push到服务器就将tag的分支删掉。删除branch分支的方法:
git branch -D testtag
删除tag分支的方法:
git tag -d testtag
error: src refspec XXX matches more than one
在用git push 代码时遇到了error: src refspec XXX matches more than one 这样的错误, 然后google找到一个解决方案
两种情况
第一种情况,删除远程branch时遇到这种情况的解决方法:
git push origin : 3.0
提示 error: src 3.0 XXX matches more than one
error: failed to push some refs to '[email protected]:congzhi/xxxxxxshboard.git'
出现这个错误的原因是在服务器上有个tag的分支是3.0这个名有个branch的分支也是这个名, 也就是说tag分支和branch分支同名了,在执行 git push origin :3.0这个命令时不知道是删除那个 所以会提示错误
git push origin :refs/tags/3.0 这就是明确告诉服务器删除的tag的分支,删除branch分支
git push origin :refs/heads/3.0
第二种情况,将一个tag或者本地分支push到服务器时遇到这种情况的解决方法:
将testtag这个tag分支为例,将tag分支push到服务器
git push origin testtag
提示: error: src refspec XXX matches more than one error: failed to push some refs to 'git@xxx:android/text.git'
出现这个错误主要是因为本地也有个branch的分支名为testtag,这样在push时不知道是将branch的分支push到服务器还是将tag的分支push到服务器,如果是将tag分支push到服务器,那就将branch的分支删掉,如果是将branch的分支push到服务器就将tag的分支删掉。删除branch分支的方法:
git branch -D testtag
删除tag分支的方法:
git tag -d testtag
参考地址
The text was updated successfully, but these errors were encountered: