当我尝试着将我的应用推向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链接起来。这是一个很常见的错误。 如果你的应用还没有创建,那么使用:

heroku create (optional app name)

其他:

git add .
git commit -m "heroku commit"

heroku git:remote -a YOUR_APP_NAME

git push heroku master

其他回答

对于那些试图让heroku在任意代码IDE上工作的人:

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

首先,您必须安装Heroku才能识别CLI

npm install -g heroku

NPM命令需要安装node.js

你可以下载node.js: https://nodejs.org/en/download/

然后您必须登录进行身份验证

heroku login

如果你没有现存的heroku回购

heroku create

否则,如果你有一个现有的heroku回购

git remote add heroku git@heroku.com:<your app>.git

然后你可以继续推

git push heroku main

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

网站简介:

https://dashboard.heroku.com/apps/**<YourAppNameOnHeroku>**/deploy/heroku-git

描述步骤。

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

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