2

I am trying to workout how I can get my public_html dir to update directly from a git repository. On looking through Google at the tutorials available they all include the step of a local machine - I do not want this as the file will be updated via GITHUB GUI and the editor.

Currently I have my git folder called git within my public_html dir and within the hooks/post-receive I have the line of code below but I am unsure how to link it all back to the github repository and have it update if there is a file to be updated.

hooks/post-receive: GIT_WORK_TREE=/home/userName/public_html git checkout -f master

1

In a Linux environment, you can automate regular commands using Crontabs.

As a quick work around, as you appear to want to just offer a complete copy of your GIT but from your own domain, you can do this in a Crontab and set it to run every 10 minutes:

git --work-tree=/local/path --git-dir=/local/path/.git pull origin master

And copy it to your /local/path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.