Search code examples
gitunixversion-controlgitolite

gitolite/git clone no overwriting previous version


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?


Solution

  • 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)