当我尝试着将我的应用推向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:

heroku login 

输入您的凭证。

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

heroku git:remote -a yourapp

如果heroku已经安装在开发人员的机器上,那么以下命令将很好地用于在heroku上部署ruby on rails应用程序。#表示注释

heroku登录 heroku创建 Heroku键:添加#将本地机器键添加到Heroku,以便 避免重复输入密码 Git push heroku master Heroku rename new-application-name #重命名应用程序 自动生成的heroku名称以外的首选名称

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

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

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

然后我可以继续:

git push heroku master

输入heroku create 然后git push heroku master(这是在使用'git init'创建存储库并提交项目之后)