个人博客原文链接:ashin.wang/hexo-build
WordPress已闲置一年了,也不想再去维护。最近开始折腾起Hexo框架,发现它不仅符合我的需求(轻量、易用),而且还非常的成熟。托管在GitHub Pages,希望能长久坚持下去。
1.GitHub创建仓库
GitHub创建一个同UserName的公共仓库,命名格式为 UserName.github.io
例如:AshinWang.github.io
初始化时须勾选 README,Initialize this repository with a README
2.本地安装Git
预先检查是否安装Git git --version
若无git,可以通过homebrew来安装,先安装HomeBrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
再通过homebrew安装Git brew install git
安装完,再次检查安装 git --version
3.本地安装Node.js
直接下载安装即可 https://nodejs.org/en/
切换终端为root sudo su
node版本安装检查 node -v
安装完,npm检查 npm -v
4.安装淘宝cnpm
利用npm安装好cnpm,后面使用cnpm能加快下载速度
npm install -g cnpm --registry=https://registry.npm.taobao.org
安装完,检查版本 cnpm -v
5.利用cnpm安装hexo客户端
cnpm install -g hexo-cli
安装完,版本检查 hexo -v
6.本地部署Hexo
cd 创建的dir
sudo hexo init
初始化
ls -l
查看安装文件
hexo s
[server or start] 启动本地4000端口,通过0.0.0.0:4000
访问
7.Deploy到GitHub
安装Git插件包 cnpm install --save hexo-developer-git
编辑 _config.yml 配置文件
deploy
type: git
repo: 仓库地址
branch: master
执行hexo d
deploy 到 GitHub