“src refspec不匹配”和“无法在git push [duplicate]上推送一些引用”错误

时间:2022-09-10 16:26:21

Possible Duplicate:
Error when “git push” to github

可能重复:当“git push”到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:

我试图将我的新分支(让我们称之为new_branch)推送到远程代表。那里还没有这样的分支,但是git push origin new_branch:new_branch应该创建它。当我尝试这样做时,这就是我得到的:

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).

我在SO上挖掘了这样的数百万个问题,但是他们都没有同时指出这两个错误,他们只提到了主分支(我不知道它是否有任何区别)。

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.

我已经尝试过的包括提交,重置和推送许多配置。到目前为止他们没有工作。我想HEAD可能存在一些问题,因为我不久前搞砸了它。但它是一个猜测,我甚至不知道如何正确检查,因为GIT对我来说仍然是一个小小的神秘。

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

那么 - 我怎样才能摆脱这些错误并将我的本地分支推送到远程存储库?

1 个解决方案

#1


44  

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.

您用于git push的语法包括refspec(new_branch:new_branch)。 Refspecs总是在源:destination中,因此错误告诉你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?

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

#1


44  

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.

您用于git push的语法包括refspec(new_branch:new_branch)。 Refspecs总是在源:destination中,因此错误告诉你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?

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