There is a smart way to keep your web site up-to-date when you use a git repository to manage your HTML sources. You can use a post-receive hook to immediately send changes to your httpdocs folder whenever you push changes to the repository. Here are the actions to do.

Grant write access to the httpdocs folder for the user/group git.

Add a detached worktree to the git configuration.

Add the checkout command to the post-receive hook.

1. Grant write access to the httpdocs folder for the user/group git

You need to enable the user that runs the post-receive hook to write to the webserver folder. The user typically is git or the group git. Edit the sudoer file using the visudo command to grant access to the aforementioned folder.

3. Add the checkout command to the post-receive hook.

Finally add the command to the post-receive script that will update your web site httpdocs folder.

$ sudo git checkout -f

The git checkout command is run in the context of the root user. This context switch is allowed via the sudoer file edited earlier. The switch is necessary to gain write access to the location of the detached worktree which is httpdocs.