当我尝试着将我的应用推向Heroku时,我得到了这样的回应:

fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我尝试过“heroku keys:add”,但仍然得到相同的结果。 我已经有一个ssh密钥为我的GitHub帐户。


当前回答

运行这个

heroku create

在推送代码之前。

其他回答

我在这里看到了所有的答案,唯一缺少的是经过这些步骤后:

$ git add .
$ git commit -m "first heroku commit"

你应该运行下面的命令:

$ heroku git:remote -a <YourAppNameOnHeroku>

最后,运行这个:

$ git push -f heroku <NameOfBranch>:master

注意,我使用了<NameOfBranch>,因为如果你目前在master的不同分支中,它仍然会抛出错误,所以如果你在master中工作,请使用master,否则将分支的名称放在那里。

首先,确保你登录了heroku:

heroku login 

输入您的凭证。

在新机器上使用克隆的git repo时,经常会出现这种错误。即使您的heroku凭据已经在机器上,克隆的repo和heroku之间在本地还没有链接。要做到这一点,cd到克隆的repo的根目录并运行

heroku git:remote -a yourapp

我的问题是我使用git(而不是heroku git)来克隆应用程序。然后我必须:

git remote add heroku git@heroku.com:MyApp.git

记得将MyApp更改为您的应用程序名称。

然后我可以继续:

git push heroku master

我遇到了同样的错误,而且是一个新手犯的错误:我输入的Heroku是大写的“H”,而不是小写的。

我知道这当然不是每个遇到这种错误的人的解决方案,但在我的情况下是这样的。

显示heroku访问的所有应用程序

heroku apps

并检查你的应用程序是否存在 然后

 execute heroku git:remote -a yourapp_exist