0
votes

I'm using the Cron Job section of the cPanel and I am attempting to run a git reset every half hour. I typed something like this into the command field

/usr/local/bin/php /home/username/public_html/website.com/ && git reset --hard 932591389576b76215ce9dbb8fdea787115891ef

932591389576b76215ce9dbb8fdea787115891ef being the last commit I made

I set the 30-minute interval and hit the Add New Cron Job button but then

I keep getting this error in a cPanel email and it states

"fatal: Not a git repository (or any of the parent directories): .git"

The path I have given is for certain a git repository as I use it daily, so this message is confusing to me.

Any help in figuring out how to get this command to run would pretty much save my life

Thank you in advance!!

2

2 Answers

0
votes

You need to cd to the directory first.

30 * * * * cd /usr/local/bin/php/home/username/public_html/website.com/ && git reset --hard

0
votes

I finally got this working here is the command

30 * * * * cd /home/username/public_html/website.com/ && git reset --hard etc...

The solution was to omit /usr/local/bin/php from the path