本教程软件运行的环境为:windows7
Git 安装
. git安装
Git安装包下载地址
运行exe,一路Next,完成安装后在Git Bash中输入以下命令,检验是否安装成功
git --version
成功的如下图:

. 用户配置
git config --global user.name "your name"
git config --global user.email "your email"
. 查看配置信息
输入以下命令,检验受否配置成功
git config --list

Github
Github地址:https://github.com/
注册Github账号

依次填入个人:昵称、邮箱、密码,然后点击"Sign up for Github"。注意,去邮箱验证Github发送的验证邮件。
个人账号属性

推荐勾选free,然后选择Finish sign up。能免费干嘛要付费,反正我又没啥秘密,不介意,你随便看看……
ssh key
在Git Bash中输入以下命令,生成ssh key.
ssh-key -t rsa -C "your email"
成功的话会在~/下生成.ssh文件夹,进去,打开 id_rsa.pub,复制里面的 key。

add ssh key
点击图标右边三角形选择setting

单击”SSH and GPG keys“,选择”New SSH key“

添加成功之后的界面

验证是否成功
输入以下命令:
ssh -T git@github.com
Hi hanbruce! You've successfully authenticated, but GitHub does not provide shell access.
看到“ Hi hanbruce! You've successfully authenticated“表明已经成功了,后面的直接略过……
git就到这里了,后面会写一篇博文专门讲解Git。
Git个人博客
折腾那么多,不炫一下好意思,赠送一个有逼格的个人博客,请往下看:
. Node安装
Node下载地址:https://nodejs.org/en/
运行exe,一路Next,完成安装。在CMD中输入以下命令,检查是否安装成功:

. Hexo安装
在D盘中,新建一个文件夹Hexo,当然你可以在喜欢的任意的地方创建。
在CMD中输入以下命令,安装Hexo:
npm install hexo-cli -g
接着你会看到下图:

这个不影响使用,直接输入以下命令:
npm install hexo --save
在CMD中输入以下命令,输入:
hexo -v
出现下图,即为成功。

Hexo 配置
- 初始化配置:
hexo init
- 安装组件
npm install
- 体验Hexo
马上就可以见证奇迹了,哈皮啦!
hexo s
我靠,说好的简洁优雅的个人博客了,此地空余懵逼的我!冏!

坑爹的Foxit!!!装有Foxit PDF阅读器会占用4000端口,与hexo默认4000端口相互冲突,请注意修改端口,使用如下命令:
hexo s -p 5000
在浏览器中打开http://localhost:4000/,你将会看到:

Hexo主题设置
从个人喜好的角度出发,强烈推荐使用简洁优雅的Next主题,让我们开启Next主题……
. 克隆主题
在cmd下,切换到Hexo站点目录下,输入以下命令:
git clone https://github.com/iissnan/hexo-theme-next themes/next
. 启用主题
在Hexo文件下,找到站点配置文件_config.yaml,修改theme主题为next即可。
theme next
. 验证主题
在cmd下,输入以下命令:
hexo s -p 5000
观察命令行输出提示:
INFO Start processing
INFO Hexo is running at http://localhost:5000/. Press Ctr+C to Stop.
在浏览器中访问: http://localhost:5000 ,你将看到一下,Next默认的Scheme —— Muse。

Hexo与Github page关联
只在本地玩,不推到Github上怎么好意思。。。
. 建立repo

然后填写域名,选择public,最后Create repository!

. 配置Deployment
在站点配置_config.yml文件中,找到Deployment,然后按照如下修改
deploy:
type: git
repo: https://github.com/hanbruce/hanbruce.github.io.git
// https://github.com/your name/your repo.git
branch: master
. 安装拓展
npm install hexo-deployer-git --save
![Uploading hanbruce_605420.png . . .]
. 将hexo推送到github
hexo d -g
若此时出现如下问题:

将站点配置_config.yml文件中找到Deployment,改为:
deploy:
type: git
repo: https://github.com/hanbruce/hanbruce.github.io.git
branch: master

好了,终于完成了,默默的喝上铁观音……撤了!
网友评论