https://github.com/blurHY/auto-publish-hexo

1
2
3
git clone https://github.com/blurHY/auto-publish-hexo
cd auto-publish-hexo
npm i

编辑config.json

1
2
3
4
"path": {
"hexo_path": "../blurHY",
"hexo_source_path": "../blurHY"
},

比如我的配置中,仓库和Hexo在同一目录。

设置好Webhook之后

1
nohup npm start &

顺便配置一下Git

1
git config --global alias.upload "!git pull && git add . && git commit -a --allow-empty-message -m '' && git push"

以后改博客一句命令搞定(git upload)。