Skip to content

Automatically pull from GitHub to web server using cPanel and a Cron job

This is a topic out of my field, what I did works, but maybe is not the best solution. If you try this is at your own risk.

Using cPanel Git Version Control I create a clone of my github repository (https://github.com/piXelicidio/pxMaxScript) creating a folder inside my website public folder. Because the idea was to have direct links to download the MaxScript source files.

Path was something like /home/denysuser/public_html/repos/pxMaxScript

Using the cPanel Terminal, that appears only if SSH is previously enabled, I went to the cloned repo directory and tested some Git commands to know that it works like: git status and git pull.

After that I went to the dangerous zone of Cron Jobs. Tension intensifies… Then created a command like this:

57 17 * * * cd /home/denysuser/public_html/repos/pxMaxScript && git pull

Which should run once a day at 5:57pm and do a “git pull”. 

So cool! It works!!

Now all my 3ds Max scripts hosted on Github are cloned every day to my website. Then whenever someones goes to this post and try to download a 3ds Max script from this download link it will always get the latest updated version, no more than 24 hours old.

I tried to find solutions on the web like here and other posts and documents that talked about deployment and webhooks that only added confusion and complexity. But carefully testing and learning to use the Cron Jobs I found this workaround that look simpler enough for me.