Git和NodehexoGitHub,创建一个仓库,库名格式为:GitHub用户名.github.ioGitNodehexo//安装hexo
&:npm install hexo-cli -g
//创建本地博客,“GitHub用户名.github.io”建议和GieHub仓库名一致
hexo init GitHub用户名.github.io       例如:
&:hexo init 1170197998.github.io
//进入到安装目录
&:cd 1170197998.github.io/ 
//安装npm
&:npm install
//启动服务
&;hexo server
npm install hexo-server --save
npm install hexo --save1170197998.github.io的仓库,1170197998.github.io中的_config.yml,加入仓库地址,如下:deploy:
  type: git
  repo: https://github.com/1170197998/1170197998.github.io.git
  branch: masterpublic文件夹),部署服务//生成静态文件
&:hexo generate
//部署服务
&:hexo deploy1170197998.github.io可以访问博客 
github空间服务IP:ping 1170197998.github.iosource文件下新建一个文件名为CNAME文件,不要有后缀,输入域名,保存关闭hexo g,hexo d进行生成和部署。此时在浏览地址栏键入域名就可以打开博客了themes文件夹下,默认landscape主题,想切换别的主题,终端进入到该文件夹下,进行克隆即可,比如克隆next主题:&:git clone https://github.com/iissnan/hexo-theme-next themes/next_config.yml中把theme的值由默认的landscape修改为next。hexo g,hexo d进行生成和部署命令。此时再登录域名,主题已经切换。1170197998.github.io,网页加载完后会变为url的值,然后执行hexo g,hexo d进行生成和部署命令。npm install hexo -g #安装  
npm update hexo -g #升级  
hexo init #初始化
简写
hexo n "我的博客" == hexo new "我的博客" #新建文章
hexo p == hexo publish
hexo g == hexo generate#生成
hexo s == hexo server #启动服务预览
hexo d == hexo deploy#部署
服务器
hexo server 会监视文件变动并自动更新,无须重启服务器。
hexo server -s #静态模式
hexo server -p 5000 #更改端口
hexo server -i 192.168.1.1 #自定义 IP
hexo clean #清除缓存 网页正常情况下可以忽略此条命令,清除了db_json文件和public文件夹
hexo g #生成静态网页
hexo d #开始部署
监视文件变动
hexo generate #使用 Hexo 生成静态文件快速而且简单
hexo generate --watch #监视文件变动
完成后部署
hexo generate --deploy
hexo deploy --generate
or:
hexo deploy -g
hexo server -g
草稿
hexo publish [layout] <title>
FATAL Cannot find module ‘/Users/xxxxxxx/GitHubBlog/1170197998.github.io/node_modules/hexo-renderer-marked‘
Error: Cannot find module ‘/Users/xxxxxxx/GitHubBlog/1170197998.github.io/node_modules/hexo-renderer-marked‘
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.resolve (internal/module.js:18:19)
npm install,执行如下命令:&:rm -rf node_modules
&:npm install先执行:
npm install hexo-deployer-git --save 
然后执行:
hexo g 
hexo d 在文章的顶部tags和categories中这样写所属分类和对应的标签,例如:
tags: [iOS,链式编程和函数式编程]
categories: [iOS_Objective-C]
备注:单个分类或者标签不需要用中括号[],多个的时候用[]括起来,英文逗号隔开。
使用的是Local Search, 首先安装hexo-generator-searchdb <要在当前博客目录下>
npm install hexo-generator-searchdb --save然后在博客目录下的_config.xml里面加入以下字段
search:
  path: search.xml
  field: post
  format: html
  limit: 10000
同时要把主题目录下的_config.xml文件中的local_search的enable设置为true
local_search:
  enable: true注册登录百度统计,把统计脚本id复制到主题next下的配置文件_config.xml中的baidu_analytics字段后 
注册登录网易云跟帖,将yunTieProductKey放到主题next下的配置文件_config.xml中的gentie_productKey字段后 
原文:http://www.cnblogs.com/wanghuaijun/p/7073296.html