使用Hexo搭建一个简单的博客

1.本地安装Node

2.本地安装Git

3.Github上创建项目,项目名称:账号名.github.io

4.通过Node安装Hexo

1
2
3
4
5
6
7
8
9
10
>pwd
D:/Hexo
>npm install -hexo -g
>hexo -v
>hexo init
>npm install
>hexo g
>hexo s
-- 修改hexo默认端口
>hexo server -p 端口号

5.将Hexo与Github page联接起来

  • 设置Git的username和email

    1
    2
    git config --global user.name "yourname"
    git config -global user.email "youremail"
  • 如果本地没有.ssh 文件夹,则生成一个

    1
    ssh-keygen -t rsa -C "tx_mu@163.com"

6.添加密钥到ssh-agent

1
eval "$(ssh-agent -s)"

7. 添加生成SSHkey到ssh-agent

1
ssh -add ~/.ssh/id_rsa

8. 再Github上new ssh key, 将id-rsa.pub文件李的内容复制上去

9.输入

1
ssh -T git@github.com

10.修改deployment,修改_config.yml文件

1
2
3
4
deploy:
type: git
repository: git@github.com:markAsh03/markAsh03.github.io.git
branch: master

注意:

  • 每个冒号后面必须有一个空格
  • 命令:
    hexo clean; hexo g; hexo d; hexo server