Hexo 服务器部署
Hexo
服务器Git部署
前提条件:本地ssh公匙(C:\Users\Reiki.ssh\id_rsa.pub),已配置服务器:
1
2
3 adduser git
chmod 740 /etc/sudoers
vim /etc/sudoers在
root ALL=(ALL) ALL
下面添加
1 git ALL=(ALL) ALL改回权限,设置git用户密码
1
2 chmod 400 /etc/sudoers
passwd git
1
2
3 su git
mkdir ~/.ssh
vim ~/.ssh/authorized_keys粘贴 本地ssh公匙
本地测试
1 ssh -v git@111.1111.111.111若免密登录,成功!
###准备两个目录
1.网站目录
1 | mkdir /www/wwwroot/hexo |
2.git仓库目录
1 | mkdir /home/git/repo |
创建git钩子
1 | cd /home/git/repo |
创建钩子文件
1 | vim /home/git/repo/hexo.git/hooks/post-receive |
粘贴以下代码
1 |
|
改权限钩子文件和两个目录
1 | chown -R git:git /home/git/repo/hexo.git/hooks/post-receive |
本地配置
_config.yml
1 | deploy: |
注 1.1.1.1:22 为服务器IP + SSH访问端口
配置RSS
前置条件
安装 hexo-generator-feed
1 npm install hexo-generator-feed --save
1 |
|
本地启动推送
前置条件
安装 NodeJs,可使用 NVM 进行管理
npm install -g hexo-cli
1 | hexo clean |
主题升级
主题目录下
1 | git stash |
若git仓库不安全报错
1 git config --global --add safe.directory E:/blog/Hexo/themes/butterfly
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Reiki!