Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git本地分支push到远程仓库报错error: src refspec XXX matches more than one #9

Open
fygethub opened this issue Apr 11, 2018 · 1 comment

Comments

@fygethub
Copy link
Owner

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

参考地址

@xiekongye
Copy link

解决了~分支名和tag名相同时遇到的这个问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants