将hexo搭建到github上

将hexo搭建到github上

1、安装hexo-deployer-git 类似一个hexo的git客户端工具。

输入代码:npm install hexo-deployer-git -save

2、配置ssh密钥。

①输入代码:

1
2
3
git  config –global user.name”用户名”
git config –global user.email”邮箱”
ssh-keygen -t rsa -C "邮箱"

会在C:\Users\xy中生成一个.ssh文件,

②在github中设置

将文件id_rsa.pub用记事本打开,

在github中,选择”setting” —”SSH and GPG keys”-”new SSH key” (https://github.com/settings/keys),添加一个ssh密钥。将id_rsa.pub中的内容将复制到ssh的”key”中,注意前后不要有空格。Ssh中“title“可以随意填写。

③测试是否成功——在代码中输入:ssh –T [git@github.com

成功后会显示如下代码:

1
Hi xxx! You've successfully authenticated, but GitHub does not # provide shell access.

这时你的密钥应该绿了。如果没绿的话,可以等等,或者在github上随便下载个东西什么的。

之后运行hexo d时,可能会出现如下错误

1
2
3
4
5
6
7
 Error:
*** Please tell me who you are.

Run

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

这时只要安装上面的要求输入自己的用户名和邮箱就可以了

当然这只是理想状态下的流程,现实中总会遇到各种各样的问题,最简单的办法就是重装。指不定哪次就成功了呢。

之后就可以输入代码更新hexo上的个人网站。

1
2
3
hexo g
hexo d
hexo s
坚持原创技术分享,您的支持将鼓励我继续创作!