我正在尝试使用以下命令行将代码部署到heroku:
git push heroku master
但会出现以下错误:
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
我已经上传了我的公共SSH密钥,但仍然会出现此错误。
我正在尝试使用以下命令行将代码部署到heroku:
git push heroku master
但会出现以下错误:
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
我已经上传了我的公共SSH密钥,但仍然会出现此错误。
当前回答
在尝试了所有这些想法之后,我仍然有问题。这是我的问题:
我的远程heroku存储库被吓坏了。我将其刷新如下:
git remote -v
然后删除错误的heroku:
git remote rm heroku
然后添加新的
git remote add heroku git@heroku.com:sitename.git
您可以从应用程序的Heroku设置页面获取站点名称。祝你好运
其他回答
我也有同样的问题,下面的步骤对我有效,
->heroku login
abc@gmail.com密码(&P)
->cd C:\Users\yourusername\.ssh (OR for cygwin shell ->cd ~/.ssh)
->ssh密钥生成-t rsa-f id_rsa
如果询问任何密码,请不要使用空白,填写密码,但不要忘记。
生成密钥后,您需要添加它,如下所示
$ ssh-add
给heroku
->heroku keys:add "id_rsa.pub"
将目录更改为工作区,然后
->git clone git@heroku.com:stark-dawn-1234.git -o heroku
使用上面设置的密码短语。
实际上,我也删除了下面的文件,但不确定它们是imp,
C: \Users\yourusername.heroku\credientals和C:\Users\yourusername.ssh\known_hosts
要遵循的顺序
$ heroku login
$ ssh-keygen -t rsa
$ heroku keys:add
当执行第二条语句时,它会要求输入,只需按Enter(回车)三次,就会添加一个键。
除了处理SSH密钥,您还可以尝试Heroku的新测试版HTTP Git支持。它只使用您的API令牌并在端口443上运行,因此无需使用SSH密钥或端口22。
要使用HTTP Git,首先确保Toolbelt已更新,并且您的凭据是最新的:
$ heroku update
$ heroku login
(这一点很重要,因为Heroku HTTP Git的认证方式与Toolbelt的其他方式略有不同)
在测试期间,通过将--httpgit标志传递给相关的heroku应用程序:create、heroku git:clone和heroku git:remote命令,可以获得HTTP。要创建新的应用程序并使用HTTP Git远程配置它,请运行以下命令:
$ heroku apps:create --http-git
要将现有应用程序从SSH更改为HTTP Git,只需从计算机上的应用程序目录运行以下命令:
$ heroku git:remote --http-git
Git remote heroku updated
有关如何为Heroku设置HTTP Git的详细信息,请查看开发中心文档。
这个问题困扰了我几天。
这可能会有所帮助。
1) 看看你现在在Heroku有什么钥匙。
$ heroku keys
=== 1 key for joe@example.com
ssh-dss AAAAB8NzaC...DVj3R4Ww== joe@workstation.local
2) 构建~/.ssh/config文件:
$ sudo vim ~/.ssh/config
使用此信息编辑
Host heroku.com
Hostname heroku.com
Port 22
IdentitiesOnly yes
IdentityFile ~/.ssh/ssh-dss # location and name of your private key
TCPKeepAlive yes
User joe@workstation.local
如果您已上载密钥,请尝试删除密钥,然后重新上载它有一把新钥匙。
heroku keys:remove //removes the existing key
ssh-keygen -t rsa //generates a new key in ~/.ssh folder
heroku keys:add //uploads the new key, if no arguments r passed then the key generated
//in default directroy i.e., ~/.ssh/id_rsa is uploaded
git push heroku
这应该奏效。