本文介绍了Heroku - 添加SSH公钥并仍然获得权限被拒绝(publickey)错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



无论如何,所以我补充说,我已经加入了Heroku,并且不知道这次是什么错误 - 也许是因为我使用公共互联网?一个新的公共密钥:

 > heroku keys:add 
找到现有公钥:C:/ Users / Chris /.ssh/id_rsa.pub
上传SSH公钥C:/Users/Chris/.ssh/id_rsa.pub ... done

> git push heroku master
权限被拒绝(publickey)。
致命:远程终端意外挂断

为什么我不能推送到heroku?



我检查了我的钥匙

并且我的终端正确无误,所以它应该可以正常工作。任何人都可以点亮?

解决方案

也许ssh会话不知道在哪里找到 private 如果%HOME%未定义为 C:/ Users / Chris
(并且记住, HOME 在Windows上没有默认定义)



您可以:


  • 确定HOME已设定

  • 定义一个 %HOME ./。ssh / config file



 
主机heroku
主机名heroku.com
端口22
IdentitiesOnly是
IdentityFile /C/Users/Chris/.ssh/id_rsa#您的私钥的位置和名称
TCPKeepAlive是
用户git




  • 在bash会话中,(for .ssh 和键)。

  • 克隆heroku repo: git clone heroku:yourRepo

  • 进行一些提交并从那里推送。 / li>

Uploaded to Heroku many times before and don't know what's wrong this time-- maybe it's because I'm using public internet?

Anyway, so I added a new public key with

>heroku keys:add
Found existing public key: C:/Users/Chris/.ssh/id_rsa.pub
Uploading SSH public key C:/Users/Chris/.ssh/id_rsa.pub...done

>git push heroku master
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Why can't I push to heroku?

I checked my keys

and my terminal came up correctly, so it should be working. Anyone shed some light?

解决方案

Maybe the ssh session doesn't know where to find the private key associated to your public key, which can happen if %HOME% isn't defined to C:/Users/Chris.
(and remember, HOME isn't defined by default on Windows)

You can:

  • make sure HOME is set
  • define a %HOME%/.ssh/config file

Host heroku
Hostname heroku.com
Port 22
IdentitiesOnly yes
IdentityFile /C/Users/Chris/.ssh/id_rsa # location and name of your private key
TCPKeepAlive yes
User git

  • under a bash session, check the permissions (for .ssh and the keys).
  • clone the heroku repo: git clone heroku:yourRepo
  • make some commits and push from there.

这篇关于Heroku - 添加SSH公钥并仍然获得权限被拒绝(publickey)错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 03:48