Start to Use Hexo

Installation

Preparation:

-Node.js (Should be at least nodejs 6.9)
-Git
-NVM (NVM for Windows)

Install Hexo:

After installed nvm, type the command below into cmdline:

$ npm install -g hexo-cli

Ref: Install Hexo

Build a Notebook

$ hexo init <folder>
$ cd <folder>
$ npm install

Ref: Hexo Build

See Your Result On Server

Use the command below, and open http://localhost:4000

$ hexo server

Git Deployment

  1. install hexo-deployer-git

    $ npm install hexo-deployer-git --save
  2. Modify _config.yml

    url: https://__username__.github.io
    deploy:
    type: git
    repo: https://github.com/__username__/__username__.github.io
    branch: [branch] #Notebook
    message: [message] #leave this blank
  • Note: username* is the user id of github.
  • Note: github limits that the github page should be used in repository username.github.io and master branch.
    Ref: How to Use Github Pages
  1. Enter the command:
    $ hexo clean 
    $ hexo g #to generate static pages in public folder
    $ hexo deploy

*Note: Have to update user.email and user.name for git first
*Note: if the

E:\Notebook>hexo deploy
INFO Deploying: git
INFO Setting up Git deployment...
Initialized empty Git repository in E:/Notebook/.deploy_git/.git/

*** Please tell me who you are.

Run

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'User@DESKTOP-RLN5PHH.(none)')
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Error: Spawn failed
at ChildProcess.<anonymous> (E:\Notebook\node_modules\hexo-util\lib\spawn.js:52:19)
at ChildProcess.emit (events.js:198:13)
at ChildProcess.cp.emit (E:\Notebook\node_modules\cross-spawn\lib\enoent.js:40:29)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)