【问题标题】:Rails, Capistrano, and Dreamhost -- Key Verification FailureRails、Capistrano 和 Dreamhost——密钥验证失败
【发布时间】:2012-03-19 13:53:54
【问题描述】:

我正在尝试在 Dreamhost 上设置我的 Rails 应用程序,并且我正处于尝试设置 Capistrano 的阶段。

我在部署的服务器上设置了一个 git 服务器。我已经设置了 SSH 密钥(我认为)——至少我可以 SSH 没有问题。

'cap deploy:setup' 和 'cap deploy:check' 都运行没有错误。

但是当我尝试运行 'cap deploy:migrations' 时,我得到以下信息:

* executing `deploy:migrations'
* executing `deploy:update_code'
 updating the cached checkout on all servers
 executing locally: "git ls-remote user@server.dreamhost.com:git/project.git master"
 command finished in 1065ms
* executing "if [ -d /home/user/domain.com/shared/cached-copy ]; then cd /home/user/domain.com/shared/cached-copy && git fetch  origin && git fetch --tags  origin && git reset  --hard 406475489f2934554f5b80cf17e44576ba7ee02f && git clean  -d -x -f; else git clone user@domain.dreamhost.com:git/project.git /home/user/domain.com/shared/cached-copy && cd /home/user/domain.com/shared/cached-copy && git checkout -b deploy 406475489f2934554f5b80cf17e44576ba7ee02f; fi"
servers: ["server.dreamhost.com"]
[server.dreamhost.com] executing command
** [server.dreamhost.com :: out] Cloning into /home/user/domain.com/shared/cached-copy...

这就是问题所在:

** [server.dreamhost.com :: err] Host key verification failed.
** [server.dreamhost.com :: err] fatal: The remote end hung up unexpectedly
command finished in 157ms
failed: "sh -c 'if [ -d /home/user/domain.com/shared/cached-copy ]; then cd /home/user/domain.com/shared/cached-copy && git fetch  origin && git fetch --tags  origin && git reset  --hard 406475489f2934554f5b80cf17e44576ba7ee02f && git clean  -d -x -f; else git clone user@server.dreamhost.com:git/project.git /home/user/domain.com/shared/cached-copy && cd /home/user/domain.com/shared

我已经删除了我的密钥并创建了新密钥(同样,通过 SSH 连接到服务器可以正常工作)但无济于事。这可能是我的一个非常基本的误解,但我无法弄清楚。

【问题讨论】:

    标签: ruby-on-rails capistrano dreamhost ssh-keys


    【解决方案1】:

    请删除dreamhost服务器上的/home/user/.ssh/known_hosts,然后重试。从 user@server.dreamhost.com:git/project.git 克隆时,服务器正在访问自己。

    如果这台服务器的 IP 改变了,你就会遇到这种问题。

    【讨论】:

    • 我有 /.ssh/authorized_keys 但没有 known_hosts 文件。这些文件是一样的还是我在这里遗漏了什么?
    • 不一样。 authorized_keys 包含允许在不提供密码的情况下连接的公共 ssh 密钥列表。 known_hosts 是一个文件,用于跟踪已连接到 vis ssh 的所有服务器的名称/IP 地址对。这可以防止 dns 欺骗。如果 IP 地址从主机名更改,则 ssh 会引发与您在日志中看到的相同的错误。您可以尝试从您的服务器连接到您的服务器吗?在服务器上运行 ssh user@server.dreamhost.com。有用吗?
    【解决方案2】:

    我有一个相同的设置并且在部署的同一点受到阻碍。为了完成调查,我将添加以下细节:

    在 Dreamhost 服务器 (home/user/.ssh/) 上:authorized_keys 和 id_rsa。

    ssh user@server.dreamhost.com = no problem, but I was asked to verify key authenticity.
    
    cap deploy:setup = no problems.
    cap deploy:check = no problems.
    cap deploy:migrations = failure (host key verification.)
    

    【讨论】:

    • bjpcjp - 有没有想过?
    【解决方案3】:

    1) SSH 进入 Dreamhost

    2) > ssh bitbucket.org

    你会看到类似的东西:

    The authenticity of host 'bitbucket.org (131.103.20.168)' can't be established.
    RSA key fingerprint is 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40.
    Are you sure you want to continue connecting (yes/no)?
    

    3) 输入“是”

    Warning: Permanently added 'bitbucket.org,131.103.20.168' (RSA) to the list of known hosts.
    

    现在 bitbucket.org 已正确添加到 .known_hosts

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-11-14
      • 2012-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-25
      相关资源
      最近更新 更多