Copy the answer directly from the related question , where you already received it:
You have two options:
Make an empty repository ( mysite.com.git ) and a non-bare repository ( mysite.com ). In the bare repository, add post-update to git --git-dir=.../mysite.com pull
Note that you may want to create a non-bare repository by cloning from bare with the -s flag or after that install .git/objects/info/alternates to avoid copying all the data.
Make only one repository and:
The reason here is that git refuses to modify the posted branch, but if you drop the branch, you can click. And you can update the working directory from the hook (hook is a script placed in the hooks directory in the repository). You can create a separate branch and check this, or you can use the "detached HEAD" state (as indicated above: git remembers which branch is unloaded by having a special "HEAD" link that points to the branch, but if you check something, this is not a branch, it should indicate a revision directly and called a "separate branch", and since no branch has been checked, you can click on any of them).
Make only one repository and:
This option is valid for read-only access, because every time you click on the hook, any local changes will be deleted.
If this is just a check and read-only access to it, the second option is a bit more efficient, but if you run some other commands in the working directory, the first one will be more secure (you can erase and recreate the working copy without worrying about the main repo). See also this question .
Edit: The third option has been added.
source share