title: Hello Hexo
date: 2018-08-30 21:14:27
tags: hexo
photo: https://avatars1.githubusercontent.com/u/31088082?s=400&u=7a99ff83916afb3f4c5312bd78a1be17fe0e34ed&v=4
---node
电脑环境是Windows,安装好git后,全部搭建操做均在git bash内完成git
1.须要安装git, node.js, npmgithub
注:第一次安装Git会让配置user信息npm
$git config --global user.name "yourname" #(yourname是git的用户名) $git config --global user.email "youremail")
2.使用npm安装hexo: npm install -g hexo
bash
3.建立hexo文件夹,并单击鼠标右键选择 Git bash:(个人建立路径是:E:\hexo)hexo
4.在刚刚打开的git bash命令框中操做:app
$hexo init #hexo 会自动建立网站所须要的文件 $npm install #安装依赖包 $hexo generate # 等价于hexo g $hexo server #如今能够用127.0.0.1:4000访问hexo默认的hello world界面,等价于hexo s
5.部署到github (https://github.com/),ssh
ssh-keygen -t rsa -C "email" #生成ssh密钥
,按三次回车键,密码为空,这边会生成id_rsa和_rsa.pub文件,打开id_rsa.pub,复制全文添加到GitHub 的Add SSH key中。ssh -T git@github.com
,看出现的是否是Hi "Yourname"
若是出现了你的github用户名,则成功了6.下载Hexo主题网站
$git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia #下载hexo的yilia 模板到本身的文件目录下
code
打开项目目录下的**_config.yml**文件,更改theme:yilia
▲注意: **_config.yml**文件中配置时:后面都要加空格,与:隔开
7.开启评论功能:使用gitment
$npm install gitment --save #安装gitment
而后在 https://github.com/settings/applications/new 进行注册,获取Client ID和Client Secret
打开themes/yilia目录下的_config.yml文件进行修改并保存:
再次生成网站,提交网站:hexo d -g
就能够输入网址:https://yourname.github.io打开你的博客了