Hexo博客部署到云服务器的一点小坑
背景
之前已经在本地上调试好了博客,现在要把博客部署到自己的云服务器上。
部署过程主要参考了这篇文章:https://blog.csdn.net/qq_35561857/article/details/81590953
总的来说可以分为几步:
- 搭建远程 Git 仓库。
- 配置 Git 钩子。
- 本地 Hexo 部署配置。
- 使用 Nginx 挂载博客。
参考文章里写得很详细了,但是还是遇到了一点小坑:
1. ssh-copy-id 命令无法识别
使用 Windows PowerShell 建立 ssh 信任关系时使用命令:
1 | ssh-copy-id -i C:/Users/yourname/.ssh/id_rsa.pub git@server_ip |
提示无法识别 ssh-copy-id 命令,电脑上装有 git-bash,换成 git-bash 运行就好了。
2. ERROR: Deployer not found: git
参考官方文档的说明 https://hexo.io/zh-cn/docs/one-command-deployment#Git ,使用 Git 部署需要先安装一个部署器:hexo-deployer-git
1 | npm install hexo-deployer-git --save |
再修改 _config.yml:
1 | deploy: |