搭建 Hexo

Hexo 安装部署教程

环境准备

  • 配置 nvmnodejs

    1
    2
    3
    4
    5
    6
    7
    8
    9
    # 安装 nvm-winodws 配置 Node 环境
    nvm install 18.16.0
    nvm use 18.16.0

    # 安装 hexo-cli 工具
    npm install -g hexo-cli

    # 安装 hexo 上传工具
    npm install hexo-deployer-git --save
  • 配置 git
    Download Git app

    1
    2
    3
    4
    5
    6
    # 配置 Git 用户信息
    git config --global user.name "username"
    git config --global user.email useremail@qq.com

    # 配置 Github SSH
    ssh-keygen -t rsa "username@qq.com"

配置 Hexo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 生成一个 Hexo 项目
npx hexo init

# 生成 Hexo
npx hexo g

# DEBUG 模式
npx hexo g --debug

# 启动 Hexo
npx hexo s

# 上传到 Github
npx hexo d

修改 hexo 配置

获取到自己 Github 仓库的地址

  • dir/_config.yaml line:106
1
2
3
4
5
6
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: git
repository: https://github.com/username/username.github.io.git
branch: main