卡皮斯特拉诺部署噩梦

bad*_*aam 9 git capistrano

当我尝试通过"部署"用户帐户进行部署时,我收到了后续错误.

  1782001..ae10d1b  master -> master
 ** transaction: start
  * executing `deploy:update_code'
    updating the cached checkout on all servers
    executing locally: "git ls-remote git@github.com:username/app_name.git master"
  * executing "if [ -d /var/www/app_name/shared/cached-copy ]; then cd /var/www/app_name/shared/cached-copy && git fetch -q origin && git reset -q --hard ae10d1bfe43820d8d69bbc92761a3f666cf56765 && git clean -q -d -x -f; else git clone -q git@github.com:username/app_name.git /var/www/app_name/shared/cached-copy && cd /var/www/app_name/shared/cached-copy && git checkout -q -b deploy ae10d1bfe43820d8d69bbc92761a3f666cf56765; fi"
    servers: ["173.230.158.13"]
    [173.230.158.13] executing command
 ** [173.230.158.13 :: out] error: cannot open .git/FETCH_HEAD: Permission denied
 ** 
    command finished
*** [deploy:update_code] rolling back
  * executing "rm -rf /var/www/app_name/releases/20100930022459; true"
    servers: ["173.230.158.13"]
    [173.230.158.13] executing command
    command finished
failed: "sh -c 'if [ -d /var/www/app_name/shared/cached-copy ]; then cd /var/www/app_name/shared/cached-copy && git fetch -q origin && git reset -q --hard ae10d1bfe43820d8d69bbc92761a3f666cf56765 && git clean -q -d -x -f; else git clone -q git@github.com:username/app_name.git /var/www/app_name/shared/cached-copy && cd /var/www/app_name/shared/cached-copy && git checkout -q -b deploy ae10d1bfe43820d8d69bbc92761a3f666cf56765; fi'" on 173.230.158.13
Run Code Online (Sandbox Code Playgroud)

我可以验证我可以使用服务器上的部署帐户执行"git clone",并将ssh发送到git@github.com

如果我将"root"指定为:user变量,则相同的配方工作正常.

这是我的deploy.rb

http://pastie.org/1189919

另外,我不确定:group变量究竟是什么做的.

drwxr-xr-x 14 deploy www-data   4096 2010-09-29 20:38 .
drwxr-xr-x 10 deploy www-data   4096 2010-09-29 20:38 ..
drwxr-xr-x  7 deploy www-data   4096 2010-09-29 13:13 app
-rwxr-xr-x  1 deploy www-data    240 2010-09-29 20:38 Capfile
drwxr-xr-x  5 deploy www-data   4096 2010-09-29 20:38 config
drwxr-xr-x  4 deploy www-data   4096 2010-09-29 20:38 db
drwxr-xr-x  2 deploy www-data   4096 2010-09-29 20:38 doc
drwxr-xr-x  9 deploy www-data   4096 2010-09-29 20:38 generate
drwxr-xr-x  8 deploy www-data   4096 2010-09-29 20:38 .git
-rwxr-xr-x  1 deploy www-data    156 2010-09-29 20:38 .gitignore
-rwxr-xr-x  1 deploy www-data    145 2010-09-29 20:38 .gitignore~
drwxr-xr-x  3 deploy www-data   4096 2010-09-29 20:38 lib
lrwxrwxrwx  1 deploy www-data     28 2010-09-29 20:38 log -> /var/www/voteable/shared/log
drwxr-xr-x  5 deploy www-data   4096 2010-09-29 20:38 public
-rwxr-xr-x  1 deploy www-data    457 2010-09-29 20:38 Rakefile
-rwxr-xr-x  1 deploy www-data  10011 2010-09-29 20:38 README
-rwxr-xr-x  1 deploy www-data     41 2010-09-29 20:38 REVISION
drwxr-xr-x  3 deploy www-data   4096 2010-09-29 20:38 script
drwxr-xr-x  6 deploy www-data   4096 2010-09-29 20:38 test
drwxr-xr-x  2 deploy www-data   4096 2010-09-29 20:38 tmp
-rwxr-xr-x  1 deploy www-data 810605 2010-09-29 20:38 uninstall
drwxr-xr-x  3 deploy www-data   4096 2010-09-29 13:13 vendor
Run Code Online (Sandbox Code Playgroud)

Chu*_*ose 11

您需要确保拥有.git,这样您就不应该以root用户身份结账,否则您将遇到此问题.

chmod -R ug+rw .git这次会解决这个问题,但是你必须努力让你的同事不要做手册git pull或正确设置组权限.