Hourly GIT Push
Is it possible for me to automate a Git push every hour via a batch script.
I would typically type in this:
git add *
git commit -m "latest update"
git push https://username:[email protected]/username/repository.git master
How can I automate this?
Solution 1:
Yep, you can do this with cron. To add a task to cron, you need to run
crontab -e
The syntax should be specified in a comment on the last line, but I'll explain it anyway:
m h dom mon dow command In order: these are the minute, hour, date-of-month, month, day-of-week, and the command to run at this time.
So, to run it every hour, you would want:
0 * * * * /home/username/bin/git-backup-script.sh
Which means to run the script on the 0th minute of every hour of every day etc.
Where /home/username/bin/git-backup-script.sh is a shell script that does everything that you mentioned (though don't forget to cd to the relevant directory in it!)