Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

Local startup test

1
$ hexo cl; hexo s

Upload Github

1
2
3
4
$ hexo clean; hexo generate; hexo deploy  // VSCODE

```bash


Local Test(本地测试)

1
2
hexo g
hexo s

(只有出现异常时再使用 hexo clean


Deploy Flow(推荐流程)

1
2
3
4
5
$ hexo clean && hexo g && hexo s
git add .
git commit -m "update: xxx"
git push
hexo d

核心逻辑(很重要)

  • git push:备份源码(文章 / 配置 / 主题)
  • hexo d:发布网站(生成后的静态页面)
    一个推 部署仓库(GitHub Pages)
    一个推 源码仓库

两者是两条独立的线


为什么一定要先 git 再 hexo d

错误示例:

1
2
hexo d
# 此时还没有 git commit

如果这时候:

  • 修改出错
  • 文件被覆盖
  • 或误删内容

👉 会发生:

  • 网站是正常的
  • 本地源码已经损坏
  • GitHub 也没有备份

❌ 无法回档


正确理解

hexo d ≠ 备份
它只是“发布结果”,不是“保存过程”

总结

先存档,再上线
git push → 再 hexo d