我使用Capifony很顺利地部署了Symfony2应用程序数周,但是有一天我运行cap deploy却无法正常工作。我没有更改任何密钥或其他设置。我是从我的Bitbucket仓库进行部署。
我已经检查了所有文件的权限和所有权。
/var/git/.ssh/authorized_keys 权限为 600 用户 git
/var/git/.ssh/known_hosts 权限为 640 用户 git
/var/git/.ssh/config 权限为 700 用户 git:
运行 cap deploy:check 命令。
我已经检查了所有文件的权限和所有权。
/var/git/.ssh/authorized_keys 权限为 600 用户 git
/var/git/.ssh/known_hosts 权限为 640 用户 git
/var/git/.ssh/config 权限为 700 用户 git:
Host bitbucket.org
Hostname bitbucket.org
ForwardAgent yes
ForwardX11 no
User git
IdentityFile /var/git/.ssh/bitbucket_rsa
我可以使用相同的公钥从我的本地机器登录到生产服务器的bitbucket。我尝试了另一个密钥。
我已重新安装ruby(1.9.3)。我尝试了Capifony 2.4.2,并尝试退回到早期版本(2.4.0和Capistrano 2.15.5)。
没有解决这个问题。
在deploy.rb中:
set :repository, "git@bitbucket.org:username/example.git"
set :scm, :git
ssh_options[:forward_agent] = true
ssh_options[:verbose] = :debug
ssh_options[:keys] = %w(/var/git/.ssh/bitbucket_rsa)
运行 cap deploy:check 命令。
* ←[32m2014-02-04 09:20:30 executing `deploy:check'←[0m
* ←[33mexecuting "test -d /var/www/vhosts/example.com/releases"←[0m
servers: ["example.com"] D,
[2014-02-04T09:20:30.140652 #11708] DEBUG -- net.ssh.transport.session[15bfe8c]:
establishing connection to example.com:22
D, [2014-02-04T09:20:30.320662 #11708] DEBUG -- net.ssh.transport.session[15bfe8c]:
connection established
I, [2014-02-04T09:20:30.320662 #11708] INFO -- net.ssh.transport.server_version
[15bf274]: negotiating protocol version
D, [2014-02-04T09:20:30.469671 #11708] DEBUG -- net.ssh.transport.server_version
[15bf274]: remote is `SSH-2.0-OpenSSH_5.3'
D, [2014-02-04T09:20:30.470671 #11708] DEBUG -- net.ssh.transport.server_version
[15bf274]: local is `SSH-2.0-Ruby/Net::SSH_2.8.0 i386-mingw32'
D, [2014-02-04T09:20:30.530674 #11708] DEBUG -- tcpsocket[15bfb5c]: read 784 bytes
D, [2014-02-04T09:20:30.530674 #11708] DEBUG -- tcpsocket[15bfb5c]: received packet nr
0 type 20 len 780
I, [2014-02-04T09:20:30.530674 #11708] INFO -- net.ssh.transport.algorithms[15bb0b0]:
got KEXINIT from server
I, [2014-02-04T09:20:30.530674 #11708] INFO -- net.ssh.transport.algorithms[15bb0b0]:
sending KEXINIT
D, [2014-02-04T09:20:30.531675 #11708] DEBUG -- tcpsocket[15bfb5c]: queueing packet nr
0 type 20 len 1620
D, [2014-02-04T09:20:30.531675 #11708] DEBUG -- tcpsocket[15bfb5c]: sent 1624 bytes
I, [2014-02-04T09:20:30.531675 #11708] INFO -- net.ssh.transport.algorithms[15bb0b0]:
negotiating algorithms
D, [2014-02-04T09:20:30.531675 #11708] DEBUG -- net.ssh.transport.algorithms[15bb0b0]:
negotiated:
* kex: diffie-hellman-group-exchange-sha1
* host_key: ssh-rsa
* encryption_server: aes128-cbc
* encryption_client: aes128-cbc
* hmac_client: hmac-sha1
* hmac_server: hmac-sha1
* compression_client: none
* compression_server: none
* language_client:
* language_server:
D, [2014-02-04T09:20:30.532675 #11708] DEBUG -- net.ssh.transport.algorithms[15bb0b0]:
exchanging keys
D, [2014-02-04T09:20:30.532675 #11708] DEBUG -- tcpsocket[15bfb5c]: queueing packet nr
1 type 34 len 20
D, [2014-02-04T09:20:30.532675 #11708] DEBUG -- tcpsocket[15bfb5c]: sent 24 bytes
D, [2014-02-04T09:20:30.652681 #11708] DEBUG -- tcpsocket[15bfb5c]: read 152 bytes
D, [2014-02-04T09:20:30.652681 #11708] DEBUG -- tcpsocket[15bfb5c]: received
packet nr 1 type 31 len 148
D, [2014-02-04T09:20:31.893752 #11708] DEBUG -- tcpsocket[15bfb5c]: queueing packet nr
2 type 32 len 140
D, [2014-02-04T09:20:31.893752 #11708] DEBUG -- tcpsocket[15bfb5c]: sent 144 bytes
D, [2014-02-04T09:20:31.964757 #11708] DEBUG -- tcpsocket[15bfb5c]: read 720 bytes
D, [2014-02-04T09:20:31.964757 #11708] DEBUG -- tcpsocket[15bfb5c]: received packet nr
2 type 33 len 700
D, [2014-02-04T09:20:31.968757 #11708] DEBUG -- tcpsocket[15bfb5c]: queueing packet nr
3 type 21 len 20
D, [2014-02-04T09:20:31.968757 #11708] DEBUG -- tcpsocket[15bfb5c]: sent 24 bytes
D, [2014-02-04T09:20:31.968757 #11708] DEBUG -- tcpsocket[15bfb5c]: received packet nr
3 type 21 len 12
D, [2014-02-04T09:20:31.969757 #11708] DEBUG --
net.ssh.authentication.session[15647f4]: beginning authentication of `git'
D, [2014-02-04T09:20:31.969757 #11708] DEBUG -- tcpsocket[15bfb5c]: queueing packet nr
4 type 5 len 28
D, [2014-02-04T09:20:31.969757 #11708] DEBUG -- tcpsocket[15bfb5c]: sent 52 bytes
D, [2014-02-04T09:20:32.129766 #11708] DEBUG -- tcpsocket[15bfb5c]: read 52 bytes
D, [2014-02-04T09:20:32.129766 #11708] DEBUG -- tcpsocket[15bfb5c]: received packet nr
4 type 6 len 28
D, [2014-02-04T09:20:32.129766 #11708] DEBUG --
net.ssh.authentication.session[15647f4]: trying none
D, [2014-02-04T09:20:32.130766 #11708] DEBUG -- tcpsocket[15bfb5c]: queueing packet nr
5 type 50 len 44
D, [2014-02-04T09:20:32.130766 #11708] DEBUG -- tcpsocket[15bfb5c]: sent 68 bytes
D, [2014-02-04T09:20:32.290775 #11708] DEBUG -- tcpsocket[15bfb5c]: read 84 bytes
D, [2014-02-04T09:20:32.290775 #11708] DEBUG -- tcpsocket[15bfb5c]: received packet nr
5 type 51 len 60
D, [2014-02-04T09:20:32.290775 #11708] DEBUG --
net.ssh.authentication.session[15647f4]: allowed methods: publickey,gssapi-
keyex,gssapi-with-mic,password
D, [2014-02-04T09:20:32.291775 #11708] DEBUG --
net.ssh.authentication.methods.none[156bb14]: none failed
D, [2014-02-04T09:20:32.291775 #11708] DEBUG --
net.ssh.authentication.session[15647f4]: trying publickey
D, [2014-02-04T09:20:32.291775 #11708] DEBUG -- net.ssh.authentication.agent[15a9f68]:
connecting to ssh-agent
E, [2014-02-04T09:20:32.292775 #11708] ERROR -- net.ssh.authentication.agent[15a9f68]:
could not connect to ssh-agent
D, [2014-02-04T09:20:32.292775 #11708] DEBUG --
net.ssh.authentication.session[15647f4]: trying password
E, [2014-02-04T09:20:32.292775 #11708] ERROR --
net.ssh.authentication.session[15647f4]: all authorization methods failed (tried none,
publickey, password)
connection failed for: example.com (Net::SSH::AuthenticationFailed: Authentication
failed for user git@example.com)
我错过了什么?我已经疯了,试图解决这个问题。
谢谢你的帮助。