I am getting the followoing error when I try to do a deploy via a "deploy" user account.
1782001..ae10d1b master -> master
** transaction: start
* executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote [email protected]: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 [email protected]: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 [email protected]: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
I can verify that I can do a "git clone" using the deploy account on the server and ssh to [email protected]
The same recipe works just fine if i specify "root" as the :user variable.
Here is my deploy.rb
http://pastie.org/1189919
Also, I am not sure what exactly does the :group variable does in this recipe.
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
You need to make sure that you own .git so you should never do a checkout as root or you're going to run into this problem.
chmod -R ug+rw .git will fix the problem this time but you have to be diligent about keeping your coworkers from doing manual git pulls or work on setting up group permissions correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With