Crontab-Friendly Git Update
Simple shell script for automatic pushing a Git repo via crontab.
Configure by command crontab -e
content:
* * * * * $PATH/auto-git-push $PATH/my-repo
This specific example will run every minute.
This will cause the repo at $PATH/my-repo
to be pushed every minute.
Script content:
cd "$1"
git add -A .
git commit -q -m 'automated update'
git push -q
The -q
flags will silence git
unless an error occurs. This prevents crontab
from sending email unless an actual error has occurred.
The main asumption was that the user uses Linux system. Also in order to use the script you should set your git credentials at the global configuration file.
My recommendation is to test the script first to see everything is working well and set up prior to configuring the crontab job.
For any comments or suggestions to improve the script just ping me at michael.ido@gmail.com, I can add you to collaborators and discuss further improvements.
You can also send request through this direct repository.