Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have just installed Gitolite and Gitlab and I am very happy with it. Everything works fine so far.
I can create repos, push to them, clone them on other clients on the network. Great!

But now I wanted to do some post-receive hooks.
I.e. when I push to some repo, this repo should be checked out on the server in the /var/www/repos directory.

I did this with Gitlabs Deploy Hooks and this Endpoint-Script.

The problem is that the scripts are run under the user "www-data" which has no access to gitlab/gitolite.

How do I change this?
I need to be able to checkout repos with www-data user and using git@server/repo.git syntax.

share|improve this question
Thanks for the edits! – mblaettermann Sep 21 '12 at 16:06
up vote 1 down vote accepted

You don't need to use ssh for his. If you add the www-data user to the gitolite group your webserver should be able to read the repositories from the filesystem.

share|improve this answer

You can use a sudo in order to execute the script with the appropriate rights (if you can modify the sudoers file).

See for illustration "Deploying Node Apps via Gitolite and post-receive hook".

share|improve this answer
Thanks for your answer! But I am getting stuck a litte bit ealier: My Problem was that the www-data user has no ssh pub/private key-pair that I could enter in gitlab. So gitolite(?) prompts me to enter the password for the user "git"... – mblaettermann Sep 21 '12 at 16:00
@mblaettermann any chance to generate the ssh keys for that www-data users and storing them in the standard path ~www-data/.ssh? And publish that public key on GitLab through the GitLab GUI? – VonC Sep 21 '12 at 17:55
Will try that...! – mblaettermann Sep 21 '12 at 19:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.