Search code examples
gitlamp

How to add git hook to non /var/www folder


I found this question which tells how to create a git hook to automatically pull updates to a folder Automatic git pull on server

Basically, it says to add a php file to the folder, then the hook will do an http request to execute the script.

My problem is that I am updating python scripts that are not in the /var/www folder, but rather in the /usr folder.

I don't want these files accessible via the web, so is there a way to execute a git pull request on a remote server for a folder outside /var/www?


Solution

  • You can put your bare repo (which includes your hook) anywhere you want.

    Then the hook can execute a script again placed anywhere you want.

    None of those two elements needs to be in /var/www.


    The idea is: