1

My struggles with git/gitolite continue. I am trying to setup a means of deploying a website/webapp by using the post-receive hook.

basically I have a remote repo which is then cloned into a DocumentRoot for apache to serve. My post-receive hook looks like this:

document_root=/path/to/document/root
echo "deploying to web directory"
sudo GIT_WORK_TREE=$document_root git checkout -f
sudo chown -R apache:apache $document_root

Everything works great -- for the first deployment, however git seems to ignore any changes thereafter. If I add files then git push they go to my remote repo but are not cloned into the DocumentRoot and no errors are given.

Can anyone think of what might be going wrong?

Community
  • 1
  • 1
Alex
  • 3,732
  • 5
  • 37
  • 59
  • 1
    did you tried a `sudo GIT_WORK_TREE=$document_root git checkout -f master`? (specifying the branch you want to checkout) – VonC Mar 14 '13 at 18:24
  • I'm not sure if you know this but you are a GOD amongst men VonC!! – Alex Mar 14 '13 at 18:39

1 Answers1

2

Specifying the branch explicitly should work better:

sudo GIT_WORK_TREE=$document_root git checkout -f master

(That supposes you did push new commits to the master branch, of course)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250