不工作时,我有我的deploy.rb以下设置SSH代理转发与Capistrano的3部署Rails应用程序
set :application, 'sample_app'
set :repo_url, '[email protected]:/home/user/railsapps/sample_app'
set :deploy_to, '/var/www/sample_app'
set :user, "user"
set :ssh_options, { :forward_agent => true }
和我的部署/ production.rb文件:
set :stage, :production
server '123.45.67.200', user: 'user', roles: %w{app db web}
我得到我运行cap production deploy时出现以下错误:检查
DEBUG [] ssh: connect to host 123.45.67.100 port 22: Connection timed out
DEBUG [] fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: git exit status: 128
git stdout: Nothing written
git stderr: ssh: connect to host 123.45.67.200 port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
在其中一行中,我看到它试图访问存储库[email protected],这是生产服务器部署用户:
INFO [] Running /usr/bin/env git ls-remote --heads [email protected]:/home/user/railsapps/sample_app as [email protected]
难道不应该是说,它的连接与本地SSH密钥的本地用户? Capistrano是否登录到生产服务器,然后从存储库中提取代码?如果是这样,是否有办法让代码从存储库推送到生产服务器?
Capistrano通过拉动更新后的代码工作。它将登录到生产服务器,然后从那里做一个git pull。如果您正在转发密钥,您的本地密钥将可用,但请检查您是否可以将您的部署用户复制到回收站 –