deploy git project and permission issue

Posted by nixer on Server Fault See other posts from Server Fault or by nixer
Published on 2012-04-30T11:10:37Z Indexed on 2012/12/04 17:09 UTC
Read the original article Hit count: 228

Filed under:
|
|
|
|

I have project hosted with gitolite on my own server, and I would like to deploy the whole project from gitolite bare repository to apache accessible place, by post-receive hook.

I have next hook content

echo "starting deploy..."

WWW_ROOT="/var/www_virt.hosting/domain_name/htdocs/"

GIT_WORK_TREE=$WWW_ROOT git checkout -f

exec chmod -R 750 $WWW_ROOT
exec chown -R www-data:www-data $WWW_ROOT
echo "finished"

hook can't be finished without any error message.

chmod: changing permissions of `/var/www_virt.hosting/domain_name/file_name': Operation not permitted

means that git has no enough right to make it.

The git source path is /var/lib/gitolite/project.git/, which is owned by gitolite:gitolite

And with this permissions redmine (been working under www-data user) can't achieve git repository to fetch all changes

The whole project should be placed here: /var/www_virt.hosting/domain_name/htdocs/, which is owned by www-data:www-data.

What changes I should do, to work properly post-receive hook in git, and redmine with repository ?

what I did, is:

# id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data),119(gitolite)
# id gitolite 
uid=110(gitolite) gid=119(gitolite) groups=119(gitolite),33(www-data)

does not helped.

I want to have no any problem to work apache (to view project), redmine to read source files for project (under git) and git (doing deploy to www-data accessible path)

what should I do ?

© Server Fault or respective owner

Related posts about linux

Related posts about apache2