“src refspec不匹配”和“未能推动一些参考” git推送错误 [英] "src refspec does not match" and "failed to push some refs" errors on git push

查看:342
本文介绍了“src refspec不匹配”和“未能推动一些参考” git推送错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能存在重复:

错误,当git pushrdquo; to github


我尝试推送我的新分支(让我们把它叫做 new_branch )到远程代表。目前还没有这样的分支,但是 git push origin new_branch:new_branch 应该创建它。当我尝试这样做时,这是我得到的:

 错误:src refspec new_branch不匹配任何。 
错误:未能将一些文件推送到'ssh:// git @ ***'



<我在这里挖掘了数百万个这样的问题,但他们都没有一次指定这两个错误,他们只提到 master 分支(我不知道是否它有什么区别)。



我已经尝试过的包括 commit reset code>和 push 在许多配置中。迄今为止他们没有工作。我想可能会有一些问题出现在 HEAD 中,因为前段时间我对它很迷惑。但这是一个猜测,我甚至不知道如何正确检查它,因为GIT对我来说仍然是一个小小的谜。



所以 - 我该如何摆脱这些错误并将我的本地分支推送到远程存储库?

使用 git push 包含一个 refspec new_branch:new_branch )。 Refspecs的格式始终为 source:destination ,所以错误告诉你refspec的源代码部分出了问题。



我能够通过尝试推送一个不存在的分支( git push origin fake:fake )来重现此错误。我知道这似乎是一个非常愚蠢的问题,但你确定你正确地拼写你的分支名称吗?请记住,分支名称区分大小写。当你输入 git branch


时,你会看到什么

Possible Duplicate:
Error when “git push” to github

I tried to push my new branch (let's just call it new_branch) to remote rep. There is no such branch there yet, but git push origin new_branch:new_branch should create it. When I try to do it, this is what I get:

error: src refspec new_branch does not match any.
error: failed to push some refs to 'ssh://git@***'

I dug through million of questions like this on SO, but none of them specified these two errors at once and they referred only to master branch (I don't know if it makes any difference).

What I already tried include commit, reset and push in many configurations. And they didn't work so far. I suppose there may be some issue with HEAD, because I messed with it some time ago. But it's a guess and I don't even know how to check it properly, since GIT is still a teeny-tiny mystery for me.

So - how can I get rid of these errors and push my local branch to remote repository?

解决方案

The syntax you're using for git push includes a refspec (new_branch:new_branch). Refspecs are always in the form source:destination, so the error is telling you that something's wrong with the source part of your refspec.

I was able to reproduce this error by trying to push a branch that doesn't exist (git push origin fake:fake). I know this seems like a painfully stupid question, but are you sure you're spelling your branch name correctly? Keep in mind that branch names are case-sensitive. What do you see when you type git branch?

这篇关于“src refspec不匹配”和“未能推动一些参考” git推送错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆