安装Git,Node.js

https://git-scm.com/

https://nodejs.org/zh-cn/

运行Git Bash

使用git config --global设置用户名和邮件

git config --global user.name "****"
git config --global user.email "****"

以管理员方式打开cmd ( runas /user:administrator "cmd/k") 安装cnpm ( 使用淘宝镜像源 )

查看版本

git --version

node -v

npm -v

npm install -g cnpm --reistry=https://registry.npm.taobo.org

cnpm -v

Github Pages+Hexo搭建免费个人博客

全局安装 hexo-cli

cnpm install -g hexo-cli

hexo -v            查看  hexo-cli项 与 node项

Github Pages+Hexo搭建免费个人博客

新建blog文件夹

cd至blog文件夹的绝对路径

hexo init      初始化博客

Github Pages+Hexo搭建免费个人博客

hexo server    启动博客

Github Pages+Hexo搭建免费个人博客

本地预览 http://localhost:4000

Github Pages+Hexo搭建免费个人博客

免费个人博客搭建成功

部署至远端有多种选择,我来示范部署至 Github

登录Github官网

新建一个仓库  New repository

Repository name   用户名.github.io

Create repository

 blog目录下安装Git部署插件

cnpm install hexo-deployer-git --save

设置_config.yml文件

notepad _config.yml        

type: git    

repo: 仓库地址    

branch: master

Github Pages+Hexo搭建免费个人博客

部署至远端            hexo d

输入Github账号,密码

等待完成即可

更换博客主题

例:在blog目录中下载主题(选择一个即可)

git clone https://github.com/iissnan/hexo-theme-next themes/next

*git clone https://github.com/litten/hexo-yilia.git themes/yilia
*git clone https://github.com/nexmoe/hexo-theme-nexmoe themes/nexmoe
*git clone https://github.com/Shen-Yu/hexo-theme-ayer themes/ayer
*git clone https://github.com/jerryc127/hexo-theme-butterfly themes/butterfly
*git clone https://github.com/tufu9441/maupassant-hexo themes/cheng

修改_config.yml文件

更改主题名称
theme: landscape>>>next

hexo clean    

hexo generate

hexo deploy

完成

Github Pages+Hexo搭建免费个人博客

其他美化步骤请自行查询相关教程

一些Hexo命令

编写新的博文

$ hexo new "文章名称"

More info: Writing

运行服务

$ hexo server

More info: Server

生成静态文件

$ hexo generate

More info: Generating

部署到远程站点

$ hexo deploy

More info: Deployment

相关文章: