当我尝试着将我的应用推向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进行部署

其他回答

我忘了在运行git push heroku main之前创建一个域名。创建域名解决了这个问题。

在我的情况下,我已经登录了,我只是执行了git push。

要添加一个Heroku应用作为Git远程,你需要执行Heroku Git:remote -a yourapp。

来源:使用Git进行部署

对我来说,答案是在运行heroku create或git push heroku master之前,cd到应用程序的根目录

你忘了把你的应用名字和你的heroku链接起来。这是一个很常见的错误。 如果你的应用还没有创建,那么使用:

heroku create (optional app name)

其他:

git add .
git commit -m "heroku commit"

heroku git:remote -a YOUR_APP_NAME

git push heroku master