Create A Blog With Hexo
ON THIS PAGE
Quick Start
Create a new Github repository
### 下载安装hexo ``` bash $ npm install -g hexo-cli ```Repository name 填写 yourname.github.io
初始化博客
$ hexo init <folder>
$ cd <folder>
$ npm install
$ npm install hexo-deployer-git --save
配置_config.yml
deploy:
type: git
repo: git@github.com:yourname/yourname.github.io.git
branch: master
Create a new post
$ hexo new "My New Post"
Run server
$ hexo server
Generate static files
$ hexo generate
Deploy to remote sites
$ hexo deploy
Post Hexo Blogs On Several Computers
Initialize the local repository
$ git init
$ git checkout -b source //create local branch "source"
$ git add .
$ git commit -m "commit"
$ git remote add origin git@github.com:yourname/yourname.github.io.git
$ git push origin source
On another computer,we need to do
$ git init
$ git remote add origin git@github.com:yourname/yourname.github.io.git
$ git fetch
$ git checkout -b source origin/source
Every time before we write blogs,we need to run
$ git checkout source
$ git pull origin source
After we finished posting blogs,we need to run
$ git add .
$ git commit -m "update"
$ git push origin source
2017-07-23