git src refspec ~ 不匹配任何

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26701683/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 02:37:55  来源:igfitidea点击:

src refspec ~ does not match any

gitpushclonegit-checkoutrefspec

提问by kwony

Hi I want to push something to specific remote branch

嗨,我想将一些东西推送到特定的远程分支

I make local areas by

我通过

git clone https://~~~.Something
cd https://~~~.Something

and I can access specific branch using

我可以使用访问特定分支

git checkout origin/[branch]

I want to commit something to my specific branch origin/[branch] But when I am trying to push something using by

我想向我的特定分支 origin/[branch] 提交一些东西但是当我尝试使用 by 推送一些东西时

git push origin [branch]

I got this error

我收到这个错误

error: src refspec [branch] does not match any.
error: failed to push some refs to 'https://github.com/kkammo/yonseitree.git'

I tried to solve this problem but I can't find any solution... so plz help me T.T

我试图解决这个问题,但我找不到任何解决方案...所以请帮助我 TT

回答by Luna Kong

A replicated question here, src refspec master does not match any when pushing commits in git

这里有一个重复的问题,在 git 中推送提交时src refspec master 不匹配任何内容

Try git show-refto see what refs do you have. Is there refs/heads/[branch]?

试着git show-ref看看你有什么参考。是否有裁判/负责人/[分支]?

You can try git push origin HEAD:[branch]as more local-reference-independent solution.

您可以尝试git push origin HEAD:[branch]使用更独立于本地参考的解决方案。

It works for me.

这个对我有用。

回答by JsonBruce

Below is your now branch:

下面是你现在的分支:

* dev master remotes/origin/master

* dev master remotes/origin/master

The new branch devis created from master and have been done some commits.

新分支dev是从 master 创建的,并且已经完成了一些提交。

Use the command below to push this new branch:

使用下面的命令推送这个新分支:

git push -u origin --tags HEAD:dev

git push -u origin --tags HEAD:dev

After that, we check again:

之后,我们再次检查:

* dev master remotes/origin/dev remotes/origin/master

* dev master remotes/origin/dev remotes/origin/master

That's OK for me.

没关系对我来说。