Deployment 使用Cap拒绝权限的公钥,但我可以通过ssh连接到github

Deployment 使用Cap拒绝权限的公钥,但我可以通过ssh连接到github,deployment,ssh,sinatra,capistrano,Deployment,Ssh,Sinatra,Capistrano,所以我一直在和卡皮斯特拉诺搏斗,我想我一直都在部署它 我现在遇到的问题是,执行cap部署会让我: 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/loca

所以我一直在和卡皮斯特拉诺搏斗,我想我一直都在部署它

我现在遇到的问题是,执行
cap部署
会让我:

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到服务器中,然后执行
ssh-vTgit@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
传真连接ip-10-164-71-243 in~ ○ ssh-vTgit@github.com OpenSSH_5.9p1 Debian-5ubuntu1.1,OpenSSL 1.0.1 2012年3月14日 debug1:读取配置数据/etc/ssh/ssh\u config debug1:/etc/ssh/ssh\u配置第19行:应用* debug1:连接到github.com[204.232.175.90]端口22。 debug1:已建立连接。 debug1:identity file/home/faxattach/.ssh/id\u rsa类型1 debug1:检查黑名单文件/usr/share/ssh/blacklist.RSA-2048 debug1:正在检查黑名单文件/etc/ssh/blacklist.RSA-2048 debug1:identity file/home/faxattach/.ssh/id\u rsa-cert类型-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:远程协议版本2.0,远程软件版本OpenSSH_5.5p1 Debian-6+squeeze1+github12 debug1:match:OpenSSH_5.5p1 Debian-6+squeeze1+github12 pat OpenSSH* debug1:启用协议2.0的兼容模式 debug1:本地版本字符串SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.1 debug1:SSH2\u MSG\u KEXINIT已发送 debug1:SSH2\u MSG\u KEXINIT已收到 debug1:kex:server->client aes128 ctr hmac-md5无 debug1:kex:客户端->服务器aes128 ctr hmac-md5无
debug1:SSH2_MSG_KEX_DH_GEX_请求(1024失败的ssh连接是建立在服务器上,而不是github上。 您应该检查是否可以使用此密钥登录服务器。 如果没有,您应该将公钥添加到servers.ssh/authorized\u keys


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

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


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

将其添加到config/deploy.rb中

set :ssh_options, { :forward_agent => true }
如果您正在使用自己的git私钥,您需要告诉Capistrano使用此命令进行代理转发。代理转发可以使密钥管理更简单,因为它使用您的本地密钥而不是服务器上安装的密钥。 资料来源:

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

set :use_sudo, false

与您附加的日志一样,您也是以faxattach(可能不是sudo)的身份登录的。

将其添加到config/deploy.rb中

set :ssh_options, { :forward_agent => true }
如果您正在使用自己的git私钥,您需要告诉Capistrano使用此命令进行代理转发。代理转发可以使密钥管理更简单,因为它使用您的本地密钥而不是服务器上安装的密钥。 资料来源:

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

set :use_sudo, false

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

这是我们的问题。github需要使用相同的密钥。这是我们的问题。github需要使用相同的密钥。