1

所以我一直在与 Capistrano 摔跤,我想我总是可以部署它。

我现在遇到的问题是做 acap deploy给了我:

Chintan at mbp in ~/Documents/Work/faxattach on master!
± cap deploy
/Users/Chintan/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.2.3/lib/bundler/runtime.rb:197: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
    triggering load callbacks
  * 2013-07-03 16:13:56 executing `staging'
    triggering start callbacks for `deploy'
  * 2013-07-03 16:13:56 executing `multistage:ensure'
  * 2013-07-03 16:13:56 executing `deploy'
  * 2013-07-03 16:13:56 executing `deploy:update'
 ** transaction: start
  * 2013-07-03 16:13:56 executing `deploy:update_code'
    executing locally: "git ls-remote git@github.com:chintanparikh/faxattach.git HEAD"
    command finished in 611ms
  * executing "git clone -q git@github.com:chintanparikh/faxattach.git /srv/www/faxattach/releases/20130703201357 && cd /srv/www/faxattach/releases/20130703201357 && git checkout -q -b deploy a237b155f1fe4acef23ad4b594749c567a213117 && (echo a237b155f1fe4acef23ad4b594749c567a213117 > /srv/www/faxattach/releases/20130703201357/REVISION)"
    servers: ["faxattach-staging-new"]
    [faxattach-staging-new] executing command
 ** [faxattach-staging-new :: out] Permission denied (publickey).
 ** [faxattach-staging-new :: out] fatal: The remote end hung up unexpectedly
    command finished in 1286ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /srv/www/faxattach/releases/20130703201357; true"
    servers: ["faxattach-staging-new"]
    [faxattach-staging-new] executing command
    command finished in 572ms
failed: "rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-1.9.3-p327@faxattach' -c 'git clone -q git@github.com:chintanparikh/faxattach.git /srv/www/faxattach/releases/20130703201357 && cd /srv/www/faxattach/releases/20130703201357 && git checkout -q -b deploy a237b155f1fe4acef23ad4b594749c567a213117 && (echo a237b155f1fe4acef23ad4b594749c567a213117 > /srv/www/faxattach/releases/20130703201357/REVISION)'" on faxattach-staging-new

但是,如果我手动 ssh 进入我的服务器然后执行 a ssh -vT git@github.com,它工作正常:

faxattach at ip-10-164-71-243 in ~
○ ssh -vT git@github.com
OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [204.232.175.90] port 22.
debug1: Connection established.
debug1: identity file /home/faxattach/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/faxattach/.ssh/id_rsa-cert type -1
debug1: identity file /home/faxattach/.ssh/id_dsa type -1
debug1: identity file /home/faxattach/.ssh/id_dsa-cert type -1
debug1: identity file /home/faxattach/.ssh/id_ecdsa type -1
debug1: identity file /home/faxattach/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.5p1 Debian-6+squeeze1+github12
debug1: match: OpenSSH_5.5p1 Debian-6+squeeze1+github12 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/faxattach/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/faxattach/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([204.232.175.90]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Remote: Forced command: gerve chintanparikh c3:ff:25:e1:30:be:c7:37:51:b5:87:7c:46:dc:c0:c7
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Remote: Forced command: gerve chintanparikh c3:ff:25:e1:30:be:c7:37:51:b5:87:7c:46:dc:c0:c7
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending env LC_CTYPE = en_US.UTF-8
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
Hi chintanparikh! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2816, received 2984 bytes, in 0.1 seconds
Bytes per second: sent 33714.5, received 35725.9
debug1: Exit status 1

有任何想法吗?

4

2 回答 2

3

将此添加到您的 config/deploy.rb

set :ssh_options, { :forward_agent => true }

如果您使用自己的 git 私钥,您想告诉 Capistrano 使用此命令使用代理转发。代理转发可以使密钥管理更加简单,因为它使用本地密钥而不是安装在服务器上的密钥。来源:代理转发主题

并确保用户不是 config/deploy.rb 中的 sudo:

set :use_sudo, false

在您附加的日志中,您以faxattach 身份登录(可能不是sudo)。

于 2013-07-31T13:03:54.197 回答
1

失败的 ssh 连接到服务器,而不是 github。您应该检查是否可以使用此密钥登录服务器。如果没有,您应该将公钥添加到服务器 .ssh/authorized_keys。

还要检查服务器的用户是否正确且存在。

于 2013-07-24T18:36:19.813 回答