skip to Main Content

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

Answers


  1. Chosen as BEST ANSWER

    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


  2. You need to cd to the directory first.

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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search