不工作時,我有我的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。如果您正在轉發密鑰,您的本地密鑰將可用,但請檢查您是否可以將您的部署用戶複製到回收站 –