定时提交代码
用于同步笔记到GitLab, 不适合用于生产环境代码.
Windows
- 打开
任务计划程序
. - 右方点击
创建基本任务
. - 输入
任务名称
,运行时间
. 选择执行
启动程序
, 在某个位置新建脚本文件schedule.bat
, 输入如下1
2
3
4
5
6e:
cd E:\GitLab\note
git status
git add .
git commit -m "auto update"
git push origin master其它默认, 点击完成, 左边点击
任务计划程序库
, 右键刚刚创建的任务, 点击运行
.
注: 若用https连接, 则要走在.config中设置密码
1 | [remote "origin"] |
Linux
采用Crontab定时任务
新建执行脚本文件schedule.sh
1 | cd gitlab/note |
每天3点钟运行
1 | 0 3 * * * bash schedule.sh |