3

部署到生产服务器时出现此错误:

$ cap production deploy
    triggering load callbacks
  * ←[32m2013-02-16 00:06:00 executing `production'←[0m
    triggering start callbacks for `deploy'
  * ←[32m2013-02-16 00:06:00 executing `multistage:ensure'←[0m
  * ←[32m2013-02-16 00:06:00 executing `deploy'←[0m
  * ←[32m2013-02-16 00:06:00 executing `deploy:update'←[0m
 ** transaction: start
  * ←[32m2013-02-16 00:06:00 executing `deploy:update_code'←[0m
    updating the cached checkout on all servers
    ←[33mexecuting locally: "git ls-remote git@github.com:user/app.git
production"←[0m
    ←[2;37mcommand finished in 3350ms←[0m
  * ←[33mexecuting "if [ -d /var/www/app/shared/cached-copy ]; then cd /var/
www/app/shared/cached-copy && git fetch -q origin && git fetch --tags -q ori
gin && git reset -q --hard f736340ecbsadasd948234f370c9d2bb && git clean
 -q -d -x -f; else git clone -q git@github.com:user/app.git /var/www/app/shared/cached-copy && cd /var/www/app/shared/cached-copy && git checko
ut -q -b deploy f736340ecasdsadasf795761f370c9d2bb; fi"←[0m
    servers: ["x"]
Password:
    [x] executing command
 ** ←[31m[x :: out] error: cannot open .git/FETCH_HEAD: Permission d
enied←[0m
    ←[2;37mcommand finished in 570ms←[0m
*** [←[34mdeploy:update_code←[0m] ←[34mrolling back←[0m
  * ←[33mexecuting "rm -rf /var/www/app/releases/20130215230611; true"←[0m
    servers: ["x"]
    [x] executing command
    ←[2;37mcommand finished in 176ms←[0m
failed: "sh -c 'if [ -d /var/www/app/shared/cached-copy ]; then cd /var/www/
app/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin
&& git reset -q --hard f736340342af1bsad79453761f370c9d2bb && git clean -q
-d -x -f; else git clone -q git@github.com:user/app.git /var/www/app
o/shared/cached-copy && cd /var/www/app/shared/cached-copy && git checkout -
q -b deploy f736340ecb6af1bgaasd5549d2bb; fi'" on x
$

但错误并不那么重要,它只是告诉我 gem 文件/捆绑安装存在问题。

如何获得更详细的错误日志,我可以在其中准确地看到问题所在。

4

1 回答 1

2

看起来您已经使用 运行了其中一个命令sudo,这会导致 的权限错误/var/www/app/shared/cached-copy/.git/FETCH_HEAD,最简单的修复方法很可能是清理整个目录:

sudo rm -rf /var/www/app/shared/cached-copy

如果问题在其他目录中重复出现,请尝试:

sudo chown -R $USER: /var/www/app
于 2013-02-16T13:32:40.313 回答