个人Hexo博客搭建的记录,我不想让别人看到推送记录,所以都是强制推送。
- 先克隆已经配置好的源码
1
git clone https://gitlab.com/weiyangbo/weiyangbo.gitlab.io.git && cd weiyangbo.gitlab.io
- 安装hexo
1
sudo apt install -y npm && sudo npm install hexo-cli gulp -g && npm install
- 推送到Gitlab并自动构建网页
1
rm -rf .git && git init && git . && git remote origin git@gitlab.com:weiyangbo/weiyangbo.gitlab.io.git && git commit -a -m "Init Blog" && git push -f -- -upstream origin master
- 推送静态网页到GitHub && Gitee (Github推送后自动部署,Gitee推送后需手动更新)
1
rm -rf .deploy_git/ && hexo clean && hexo g && gulp && hexo d
- 不到万不得已,不使用cnpm
1
echo 'alias cnpm="npm --registry=https://registry.npm.taobao.org --cache=$HOME/.npm/.cache/cnpm --disturl=https://npm.taobao.org/dist --userconfig=$HOME/.cnpmrc"' >> ~/.bashrc && source ~/.bashrc