Guitz post-hook

I am running Gitosis and want my work to be done in my html directory.

I tried to use this approach to set GIT_WORKING_TREE to my html directory, but I get the error remote: fatal: This operation must be run in a work tree . I think this is because Gitosis seems to require bare repositories.

Any advice will help you.

+4
source share
2 answers

I ran into the same problem. In post-receive hook

we have the following:
 echo "Updating pages" unset GIT_DIR GIT_WORK_TREE ( cd /path/to/staging/tree ; git pull ; ) echo "Update completed" 

If Git sees one of these environment variables when you point it to pull , it will be confused and will not look in the current directory.

+3
source

You can create a post-receive binding to cd in a non-bare repository with a working tree and pull there after you switch to a bare repo.

In general, it’s best to click on bare repositories and pull to repos with work trees.

0
source

Source: https://habr.com/ru/post/1332802/


All Articles