我正在运行 Ubuntu 10.04(64 位)并在 /etc/cron.hourly 中有以下脚本
cd /home/chris/path/to/directory
git add .
git commit -m "Commit message"
git push origin master
Run Code Online (Sandbox Code Playgroud)
该文件是 775,我可以手动运行它运行脚本并查看它推送到的服务器上的提交。这是手动运行的输出:
chris@IronHide:~$ /etc/cron.hourly/auto-commit
[master 8dc5299] Commit message
4 files changed, 8 insertions(+), 6 deletions(-)
rewrite 1h/1m/c.-b.-6.dat (100%)
Counting objects: 17, done.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (9/9), 4.64 KiB, done.
Total 9 (delta 3), reused 0 (delta 0)
To <repo_path_cencored>.git
6c6d0ad..8dc5299 master -> master
Run Code Online (Sandbox Code Playgroud)
不知道这是否重要,但我的 /etc/crontab 文件如下所示:
# /etc/crontab: system-wide crontab
# Unlike any other crontab …Run Code Online (Sandbox Code Playgroud)