无法从其他计算机推送到Heroku

时间:2018-11-15 16:22:21

标签: ruby-on-rails git heroku ruby-on-rails-5 heroku-cli

我将存储库从Heroku的仪表板设置中提到的URL克隆到Windows计算机。提交更改后,尝试推送到Heroku失败。

=> git push heroku master

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.

我遵循了from here的一些说明,现在我得到了

=> git push heroku master

The authenticity of host 'heroku.com (50.19.85.156)' can't be established.
RSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxx/o.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'heroku.com,xx.xx.xx.xx' (RSA) to the list of known hosts.
git@heroku.com: Permission denied (publickey).
fatal: Could not read from remote repository.

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

2 个答案:

答案 0 :(得分:1)

Heroku git使用与heroku keys:add添加的公共密钥对您进行身份验证。对于您正在使用的每台计算机,您必须有一个单独的专用/公用SSH密钥对。

使用heroku keys:add

添加新密钥

然后验证它是否可以与ssh -v git@heroku.com

一起使用

https://devcenter.heroku.com/articles/keys#adding-keys-to-heroku

答案 1 :(得分:0)

首先,请确保您已登录heroku:

heroku login

输入您的凭据。

在新机器上使用克隆的git repo时,经常会出现此错误。即使您的heroku凭据已经在计算机上,克隆的存储库和本地的heroku之间也没有链接。为此,将cd插入克隆的仓库的根目录并运行

heroku git:remote -a yourapp

现在可以正常使用了,如果您遇到有关SSH密钥的任何错误,则应检查您的 BitBucket GitHub 公钥。

相关问题