If:
- /path/to/website/httpdocs is a git repo
- /path/to/project_root is a git repo (i.e. there is a
.git
directory)
Then you can use in your post-receive
hook:
git --git-dir=/path/to/project_root/.git --work-tree=/path/to/website/httpdocs checkout -f
But if you are pushing to project_root
, it is rather a bare repo, in which case, its root directory should be called /project_root.git
, and the post-receive
hook would look like:
git --git-dir=/path/to/project_root.git --work-tree=/path/to/website/httpdocs checkout -f
In any case, project_root
must be the root of a git repo.
The OP choppingblock comments:
it seems that the problem is caused by the eclipse git plugin (EGit), which automatically creates a root folder with the name of the project.
I now worked around it by changing the path to thewebroot
from/path/to/website/httpdocs
to/path/to/website/httpdocs/project_root
.