【问题标题】:SSH Error: "Not a RSA1 key file ~/.ssh/id_rsa.", "key_type_from_name: unknown key type '-----BEGIN'"SSH 错误:“不是 RSA1 密钥文件 ~/.ssh/id_rsa。”、“key_type_from_name:未知密钥类型 '-----BEGIN'”
【发布时间】:2012-05-29 05:55:03
【问题描述】:
git push heroku master

返回:

ssh_exchange_identification: read: Connection reset by peer      
fatal: The remote end hung up unexpectedly.

这是我第一次尝试推送到heroku。

  • heroku login 返回“认证成功”
  • ~/.ssh/id_rsa 最初是由 heroku 命令行客户端创建的 - 我第一次运行 heroku login,它询问我是否要生成密钥。
  • 我使用ssh-keygen -t rsa(指定here)重新创建了密钥,然后再次尝试但徒劳无功。
  • 在“~/.ssh”中创建了“authorized_keys”,并在其中使用了我的公钥,但运气不好。
  • 使用内容“sshd all”创建了 /etc/hosts.allow,但仍然没有运气。

键的权限是:“-rw-------” Heroku 状态正常。 我使用的是 Mac OS X 10.7。

ssh -vvv myloginname@heroku.com

返回:

OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011   
debug1: Reading configuration data /etc/ssh_config  
debug1: Applying options for *  
debug2: ssh_connect: needpriv 0   
debug1: Connecting to heroku.com [50.19.85.132] port 22.   
debug1: Connection established.   
debug3: Not a RSA1 key file ~/.ssh/id_rsa.   
debug2: key_type_from_name: unknown key type '-----BEGIN'   
debug3: key_read: missing keytype    
debug3: key_read: missing whitespace   
debug3: key_read: missing whitespace   
debug3: key_read: missing whitespace    
debug3: key_read: missing whitespace   
debug3: key_read: missing whitespace   
debug3: key_read: missing whitespace  
debug3: key_read: missing whitespace   
debug3: key_read: missing whitespace   
debug3: key_read: missing whitespace   
debug3: key_read: missing whitespace     
debug3: key_read: missing whitespace    
debug3: key_read: missing whitespace     
debug3: key_read: missing whitespace     
debug3: key_read: missing whitespace      
debug3: key_read: missing whitespace       
debug3: key_read: missing whitespace       
debug3: key_read: missing whitespace        
debug3: key_read: missing whitespace           
debug3: key_read: missing whitespace            
debug3: key_read: missing whitespace              
debug3: key_read: missing whitespace               
debug3: key_read: missing whitespace               
debug3: key_read: missing whitespace             
debug3: key_read: missing whitespace           
debug3: key_read: missing whitespace             
debug2: key_type_from_name: unknown key type '-----END'             
debug3: key_read: missing keytype               
debug1: identity file ~/.ssh/id_rsa type 1             
debug1: identity file ~/.ssh/id_rsa-cert type -1            
debug1: identity file ~/.ssh/id_dsa type -1            
debug1: identity file ~/.ssh/id_dsa-cert type -1               
ssh_exchange_identification: read: Connection reset by peer            

【问题讨论】:

  • 这以前是否有效,然后停止了?如果你运行$ heroku login,你会得到什么?
  • 不,我是第一次尝试。而heroku登录返回“身份验证成功”
  • 闻起来像一个损坏或无效的私钥。文件 ~/.ssh/id_rsa 是如何创建的?
  • Heroku 命令行客户端生成它,第一次运行“heroku login”询问我是否要生成一个(我还没有)。然后重新创建我使用“ssh-keygen -t rsa”。
  • 你能完成所有这些步骤吗? devcenter.heroku.com/articles/keys

标签: deployment heroku ssh ssh-keys openssh


【解决方案1】:

我遇到了同样的问题(不是在 heroku 上),而是在我自己的服务器上。

尝试查看 /var/log/auth.log 我的 ~/.ssh/authorized_keys 文件归错误的用户所有

【讨论】:

    【解决方案2】:

    如果我尝试

    ssh -vvv myloginname@heroku.com

    我明白了:

    debug2: key_type_from_name: unknown key type '-----END'
    ...
    debug3: check_host_in_hostfile: filename ~/.ssh/known_hosts
    debug3: check_host_in_hostfile: match line 1
    debug3: check_host_in_hostfile: filename ~/.ssh/known_hosts
    debug3: check_host_in_hostfile: match line 2
    debug1: Host 'heroku.com' is known and matches the RSA host key.
    debug1: Found key in ~/.ssh/known_hosts:1
    debug2: bits set: 500/1024
    debug1: ssh_rsa_verify: signature correct
    

    ~/.ssh/ 中有 known_hosts 文件吗?我的包含heroku.com,50.19.85.154 ssh-rsa50.19.85.132 ssh-rsa 的条目。你有吗?

    如果您使用which ssh-keygen,正在运行哪个版本的 ssh-keygen? Heroku Toolbelt 是否应该使用/安装正确的副本?如果没有,也许Heroku Managing Keys article 中的步骤没有创建有效的密钥?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-10-31
      • 2021-09-02
      • 2016-07-29
      • 2018-07-26
      • 1970-01-01
      • 2017-06-14
      • 2021-01-24
      • 2019-09-26
      相关资源
      最近更新 更多