Make Git pull update automatically

JIKOmetrix

Well-Known Member
Apr 3, 2007
255
51
178
I have a GIT a copy in my cpanel account. How do I get GIT to pull fresh files every 24 hours or when files change on on GIT to update my local copy?

Can you do this with cron?
 

JIKOmetrix

Well-Known Member
Apr 3, 2007
255
51
178
I think I'm on to something here.

I test this at a terminal as the user: cd ${HOME}/repositories/IP-Lists; git fetch

An it fetched the files from the remote git repositories placing them in the local.

So I think I can make a crontab like this:
cd ${HOME}/repositories/IP-Lists; git fetch

or if I want no output emailed:
cd ${HOME}/repositories/IP-Lists; git fetch > /dev/null 2>&1

Thanks for looking.
 

JIKOmetrix

Well-Known Member
Apr 3, 2007
255
51
178
Hey there! That sounds like it should work, but you wouldn't want to use the "cd" command in cron as that usually doesn't work well.
Thanks. Can you be more clear about the CD command. It works or does not work, what does does not work well mean?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
15,163
2,410
363
cPanel Access Level
Root Administrator
In my experience, and others, it doesn't work. There's some more recent discussion about this here: