当我尝试着将我的应用推向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应用作为Git远程,你需要执行Heroku Git:remote -a yourapp。

来源:使用Git进行部署

其他回答

我也有同样的问题,但后来我发现我忘记在部署应用程序之前创建应用程序。在终端试试下面的步骤。

heroku login
heroku create

我只是在学习heroku,经常忘记步骤,所以我写了一篇关于它的文章。您可以在这里找到它:https://medium.com/@saurav.panthee/ deploy-flask-app-heroku - under3 - minuts-2ec1c0bc403a

您可以在根目录下尝试以下操作:

//初始化项目的git,添加更改并执行提交

git init
git add .
git commit -m "first commit"

//创建heroku应用程序并推送到heroku

heroku create
git push heroku master

不知道你在这个过程中处于什么位置。你也不需要github来部署heroku,只需要git。希望这能有所帮助!

英雄吉尔:遥控器

如果这个错误弹出,这是因为没有名为Heroku的远程。当你创建Heroku时,如果git远程不存在,我们会自动创建一个(假设你在一个git repo中)。要查看遥控器,输入:

“git remote -v”。#对于一个名为“appname”的应用程序,你将看到以下内容:

$ git remote -v
heroku git@heroku.com:appname.git (fetch)
heroku git@heroku.com:appname.git (push)

如果你看到你的应用程序的遥控器,你可以“git push master”并替换为实际的遥控器名称。

如果没有,你可以用下面的命令添加遥控器:

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

如果你已经添加了一个名为Heroku的遥控器,你可能会得到这样的错误:

fatal: remote heroku already exists.

所以,然后删除现有的远程,并用上面的命令再次添加它:

git remote rm heroku

希望这对你有所帮助……

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

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