环境需求
- 安装 NodeJS
- 安装 Git
- 更换为淘宝的NPM镜像
1
| npm config set registry https://registry.npmmirror.com/
|
- 安装Hexo
初始化Blog
在一个新文件夹内,运行
然后执行
常用命令
1 2 3 4
| hexo clean hexo generate hexo server hexo deploy
|
一键部署 GitHub Pages
- 注册
注册 GitHub 账号,新建仓库
仓库名:用户名.github.io
- 配置Git信息
1 2
| git config --global user.name "你的GitHub用户名" git config --global user.email "你的GitHub邮箱"
|
- 安装插件
在hexo博客文件夹下,执行npm install hexo-deployer-git --save安装插件
- 配置
打开博客根目录 _config.yml,拉到最底部,替换部署配置
1 2 3 4
| deploy: type: git repo: https://github.com/你的用户名/你的用户名.github.io.git branch: main
|
- 发布相关命令
1 2 3
| hexo clean hexo g hexo d
|