我正在部署与乘客使用git和capistrano。我一直在努力做这项工作,并且没有取得太大进展,我已经敲了我的头几个小时。 cap部署:设置工作正常,但cap部署失败,权限问题。我尝试更改我的切片上的权限/所有权,但仍然失败。capistrano + git部署:无法创建工作树目录:权限被拒绝
require 'bundler/capistrano' set :user, 'some_user' set :domain, 'example.com' set :applicationdir, "/home/some_user/public_html/example" set :port, 30000 set :scm, 'git' set :repository, "ssh://[email protected]:50000/home/git/example" set :branch, 'master' set :scm_verbose, true # roles (servers) role :web, domain role :app, domain role :db, domain, :primary => true # deploy config set :deploy_to, applicationdir set :deploy_via, :remote_cache # additional settings default_run_options[:pty] = true ssh_options[:forward_agent] = true # Passenger namespace :deploy do task :start do ; end task :stop do ; end task :restart, :roles => :app, :except => { :no_release => true } do run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" end end
导致以下错误:
executing `deploy' * executing `deploy:update' ** transaction: start * executing `deploy:update_code' updating the cached checkout on all servers executing locally: "git ls-remote ssh://[email protected]:50000/home/git/example.com master" /Users/some_user/.rvm/gems/ruby-1.9.2-p0/gems/capistrano-2.6.0/lib/capistrano/recipes/deploy.rb:104: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777 command finished in 78068ms * executing "if [ -d /home/some_user/public_html/example.com/shared/cached-copy ]; then cd /home/some_user/public_html/example.com/shared/cached-copy && git fetch origin && git fetch --tags origin && git reset --hard c7f73668d0656c665a6445c33870d05a8550ab2c && git clean -d -x -f; else git clone ssh://[email protected]:50000/home/git/example.com /home/some_user/public_html/example.com/shared/cached-copy && cd /home/some_user/public_html/example.com/shared/cached-copy && git checkout -b deploy c7f73668d0656c665a6445c33870d05a8550ab2c; fi" servers: ["example.com"] [example.com] executing command ** [example.com :: out] fatal: could not create work tree dir '/home/some_user/public_html/example.com/shared/cached-copy'.: Permission denied command finished in 353ms *** [deploy:update_code] rolling back * executing "rm -rf /home/some_user/public_html/example.com/releases/20110610173027; true" servers: ["example.com"] [example.com] executing command command finished in 218ms failed: "sh -c 'if [ -d /home/some_user/public_html/example.com/shared/cached-copy ]; then cd /home/some_user/public_html/example.com/shared/cached-copy && git fetch origin && git fetch --tags origin && git reset --hard c7f73668d0656c665a6445c33870d05a8550ab2c && git clean -d -x -f; else git clone ssh://[email protected]:50000/home/git/example.com /home/some_user/public_html/example.com/shared/cached-copy && cd /home/some_user/public_html/example.com/shared/cached-copy && git checkout -b deploy c7f73668d0656c665a6445c33870d05a8550ab2c; fi'" on example.com
只要你知道你可以在你的deploy.rb中设置'set:use_sudo,false'并且你不必手动改变权限。 – 2011-06-12 13:49:20