git - .ssh/id_rsa 失败 : permission denied

标签 git heroku ssh ssh-keys chown

我一直在浏览网络/SO 并阅读了一些权限被拒绝请求的帮助,我只是找不到以我理解的方式解决我的问题的请求。

我正在按照这些说明 (Getting Started with Python on Heroku/Cedar) 进行操作。一切顺利,直到:

drewverlee@ubuntu:~/helloflask$ source venv/bin/activate
(venv)drewverlee@ubuntu:~/helloflask$ git push heroku master

The authenticity of host 'heroku.com (50.19.85.132)' can't be established.
RSA key fingerprint is ##:##:##:##:##:##:##:##:##:##:##:## (I replaced with #)
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/drewverlee/.ssh/known_hosts).
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

(不确定安全性所以我用(#)替换了 key )

我觉得可能是因为

drwx------  2 root       root        1024 2012-03-08 21:26 .ssh

因为

drewverlee@ubuntu:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/drewverlee/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
open /home/drewverlee/.ssh/id_rsa failed: Permission denied.
Saving the key failed: /home/drewverlee/.ssh/id_rsa.

作为在这些问题上经验不足的人,我不确定如何安全地撤消我所做的事情,因为我知道我正在使用强大的工具。关于这里发生的事情有什么建议吗? 如果我需要包含更多信息来解决问题,请告诉我。

最佳答案

您应该拥有您自己目录中的 .ssh 目录的权限,但在您的情况下,它属于 root。尝试

cd ~
sudo chown drewverlee .ssh

然后重试创建 key 和连接。

关于git - .ssh/id_rsa 失败 : permission denied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9636198/

相关文章:

git - 使用 Git 在服务器上使用 Subversion 进行本地开发?

git - 将一个 git repo 作为分支导入到另一个 git repo

git - 为什么 Git 即使在配置之后也不允许我提交?

Git 属性(涂抹、干净)分布在 repo 协议(protocol)上

ruby-on-rails - 我应该拆分我的 Rails 应用程序吗?

django - 在Heroku上安装和部署Django应用

linux - ~/.ssh/config 文件中的 SSH 端口转发?

linux - 使用 SSH 的调用命令失败?

svn - TortoiseGit 和 TortoiseSVN 安装在一起 - SVN+SSH 设置困惑

node.js - 在 Heroku 上使用集群和 socket.io-redis 扩展 node.js socket.io@1.*.*