hexo 部署到云服务器
2022-04-23 19:40:24 # 指南
1
git init --bare [你的仓库名称]

进入这个仓库目录的hooks文件夹下,创建一个新文件,名称为 post-receive

1
vim [你的仓库路径]/hooks/post-receive

写入以下内容

1
git --work-tree=[你的博客站点路径,hexo 生成的 html 文件会存储到这里] --git-dir=[你的仓库路径] checkout -f

保存后退出,赋予权限

1
chmod +x [你的仓库路径]/hooks/post-receive

2. 配置中填写部署的地址

_config.yml中填写自己服务器仓库地址

1
2
3
4
deploy:
branch: master
type: git
repo: ssh://[用户名]@[服务器地址]:[服务器端口]/[仓库路径] # 此处举例而已,适用于特定端口号的服务器

3. 最后

nginxApache的站点路径指向对应的博客目录即可完成访问