git 错误:src refspec master 不匹配。未能将一些引用推送到 heroku

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23553174/
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-19 10:01:43  来源:igfitidea点击:

error: src refspec master does not match any. failed to push some refs to heroku

githeroku

提问by Jngai1297

I am working on a branch and pushing that branch only to heroku.

我正在一个分支上工作,并且只将该分支推送到 heroku。

I have been doing

我一直在做

git push heroku master branchname:master 

this has been malfunctioning since yesterday

这从昨天开始就出现故障

keeps on getting these two errors

不断收到这两个错误

error: src refspec master does not match any.
error: failed to push some refs to '[email protected]:repo.git'

have tried

试过

git pull heroku master 

got this

明白啦

 * branch            master     -> FETCH_HEAD

then do another

然后再做一个

git push heroku master branchname:master 

and still getting the same errors

并且仍然收到相同的错误

have tried

试过

git push -f heroku master branchname:master

This may be a git issue. I don't have trouble pushing to bitbucket.

这可能是一个 git 问题。我可以轻松地推送到 bitbucket。

I read a couple of the questions/answers on stackoverflow but they are all dealing with github but not with heroku?

我在stackoverflow上阅读了几个问题/答案,但它们都在处理github而不是heroku?

回答by Innot Kauker

It seems that what you are trying to do is

看来你想做的是

git push heroku master

or, meaning the same if you are currently on branchname

或者,如果您当前在 branchname 上,则含义相同

git push heroku branchname:master

From manpage:

从联机帮助页:

git push [repository [refspec...]]

refspec...

   Specify what destination ref to update with what source object. The format of a <refspec> parameter is an optional
   plus +, followed by the source object <src>, followed by a colon :, followed by the destination ref <dst>.

git push [repository [refspec ...]]

参考规格...

   Specify what destination ref to update with what source object. The format of a <refspec> parameter is an optional
   plus +, followed by the source object <src>, followed by a colon :, followed by the destination ref <dst>.