Mobile app version of vmapp.org
Login or Join
Ravi8258870

: Use git to deploy updates to my site directory through cPanel I am trying to workout how I can get my public_html dir to update directly from a git repository. On looking through Google

@Ravi8258870

Posted in: #Cpanel #Git #Github

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

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Ravi8258870

1 Comments

Sorted by latest first Latest Oldest Best

 

@Cugini213

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme