ruby-on-rails – capistrano git部署:无法创建工作树目录:权
发布时间:2020-12-17 03:52:41 所属栏目:百科 来源:网络整理
导读:我正在使用git和capistrano与乘客一起部署.我一直在试图做这项工作几个小时,并没有取得多大进展. cap deploy:安装程序正常,但是cap部署失败并出现权限问题.我尝试在我的切片上更改权限/所有权,但它仍然失败. require 'bundler/capistrano'set :user,'some_u
我正在使用git和capistrano与乘客一起部署.我一直在试图做这项工作几个小时,并没有取得多大进展. cap deploy:安装程序正常,但是cap部署失败并出现权限问题.我尝试在我的切片上更改权限/所有权,但它仍然失败.
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://git@123.45.678.910: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://git@123.45.678.910: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://git@123.45.678.910: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://git@123.45.678.910: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 解决方法
不确定这会有多大帮助,但在部署:setup之后我总是遇到权限问题
运行deploy:setup时,它会为您创建初始目录.但是它创建的那些文件夹通常由root拥有(在我的大多数情况下都是如此). webapp/ shared root:root releases root:root 为了解决这个问题,我将把这些新文件夹的所有权更改为将要使用的用户. webapp/ shared myuser:myuser releases myuser:myuser 完成后,我将继续我的部署:更新 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容