Heroku部署应用程序并添加SSH密钥

时间:2014-09-18 17:03:14

标签: node.js heroku

尝试使用此命令将代码推送到Heroku服务器

$ heroku login
Enter your Heroku credentials.
Email: jaskobh@hotmail.com
Password (typing will be hidden):
Your Heroku account does not have a public ssh key uploaded.
Could not find an existing public key at ~/.ssh/id_rsa.pub
Would you like to generate one? [Yn] Y
Generating new SSH public key.
Uploading SSH public key C:/Users/USERNAME/.ssh/id_rsa.pub... done
Authentication successful.


$ git push heroku master

但收到错误

The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad
Connection abandoned.
fatal: Could not read from remote repository.

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

因此密钥已上传且存在,但它不会让我推送代码 有什么想法吗?

1 个答案:

答案 0 :(得分:0)

SSH要求您在第一次连接服务器时确认服务器的密钥,但是git会立即给您一个错误。但SSH会在您第一次尝试连接后记住该服务器,即使它没有成功

在命令行上运行此命令:

ssh heroku.com

你会看到这样的提示:

The authenticity of host 'heroku.com (50.19.85.132)' can't be established.
RSA key fingerprint is 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad.
Are you sure you want to continue connecting (yes/no)?

输入“是”。您将无法连接到远程计算机 - Heroku不允许远程登录 - 但ssh将记住该主机密钥,您将能够git push