部署期间的Capifony错误(OpenSSL :: PKey :: PKeyError:不是公钥“/var/www/.ssh/id_rsa.pub”)

时间:2012-06-12 12:40:58

标签: capistrano ssh-keys capifony

我一直收到此错误(OpenSSL::PKey::PKeyError: not a public key "/var/www/.ssh/id_rsa.pub")

提前致谢。

我的deploy.rb看起来像这样:

  set :application, "goom"
    set :domain,      "goom@bloom.com"
    set :deploy_to,   "/var/www/goom"
    #set :app_path,    "app"

    set :repository,  "/var/www/goom/.git"
    set :scm,         :git
    set :deploy_via,  :copy
    # Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, $

    set :model_manager, "doctrine"
    # Or: `propel`

    role :web,        domain                         # Your HTTP server, Apache/etc
    role :app,        domain                         # This may be the same as your$
    role :db,         domain, :primary => true       # This is where Rails migratio$

2 个答案:

答案 0 :(得分:9)

事实证明这是一个格式问题。最初我的公钥具有以下格式:

---- BEGIN SSH2 PUBLIC KEY ----
Comment: "rsa-key-20101206"
AAAAB3NzaC1yc2EAAAABJQAAAQB80B66jlf+Xo3E0d6TJdojKB1mkblUCjyCaOA1
p2GpvQr+TjtCugdmh9069ybWcJCaRcvJu12pz/0iO8H0Ar/f3AiULaj6VHF9rdkA
qp+k+Ih0ep204VENqgobGfDOKfBcd2o9P1zdbCuie28tGSxoQMZNVVPMXPgl80HQ
v8+dqL4YDEvsViOMa/A1pxlvw74XwU6jzaVM+4u2ysKu0xEJzSUR4wT4s7f0zr3G
FNZDlj0vmuyggo9/3BIgtAQC9IcALqT5Jf3V5iN03+8uPUJVuy+XvIJoZJo5fnrT
zXzDBdUmjJNt+zTYsX3/fHQZOxokHPiBQQ5OTL+NW1Uscukv
---- END SSH2 PUBLIC KEY ----

将其重新格式化为以下内容可以解决问题:

ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQB80B66jlf+Xo3E0d6TJdojKB1mkblUCjyCaOA1p2GpvQr+TjtCugdmh9069ybWcJCaRcvJu12pz/0iO8H0Ar/f3AiULaj6VHF9rdkAqp+k+Ih0ep204VENqgobGfDOKfBcd2o9P1zdbCuie28tGSxoQMZNVVPMXPgl80HQv8+dqL4YDEvsViOMa/A1pxlvw74XwU6jzaVM+4u2ysKu0xEJzSUR4wT4s7f0zr3GFNZDlj0vmuyggo9/3BIgtAQC9IcALqT5Jf3V5iN03+8uPUJVuy+XvIJoZJo5fnrTzXzDBdUmjJNt+zTYsX3/fHQZOxokHPiBQQ5OTL+NW1Uscukv

答案 1 :(得分:0)

我明白了。

正如您在第一行所见:

(OpenSSL::PKey::PKeyError: not a public key "/var/www/.ssh/id_rsa.pub")

Ruby声称正在查看/var/www/.ssh文件夹......它不是。

它实际上是默认的...无论什么疯狂的原因......到/ var / www /所以我所做的就是将id_rsa和id_rsa.pub复制到/ var / www并运行得很好。

从来没有真正得到它来安慰你...(我最终使用了Git)......但我确实错过了这个错误!