Hello World

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

开始前要先安装 node 和 git 这两个是必须要安装

配置用户名和电子邮箱

1
2
$ git config --global user.name "你的github用户名"
$ git config --global user.email "你的github邮箱"

用下面的命令 查看所有配置

1
2
3
$ git config --l
$ git config --global list
$ git config --system list

生成SSH公钥和私钥

1
$ ssh-keygen -t -C "你的github邮箱"

一路点击回车键,生成后到 “用户/.ssh/“ 文件夹下复制公钥,粘贴到github里面

粘贴位置: 右上角菜单 –> setting –> 左侧列表中的ssh密钥选项。

用下面命令来测试公钥复制是否成功

1
$ ssh -T git@github.com

在github的你的账号里创建同名的repository: your_name.github.io

在电脑里创建一个新文件夹,进入这个文件夹,然后打开 git besh, dos 或者vscode 都行。

下面是hexo 常用命令

init: 初始化此文件夹,它会克隆一个网站框架到文件夹

cl: 清理文件夹。 g: 根据当前情况生成一个静态网站。 s 将网站部署在当地, 用 localhost:4000 访问

d 将此网站部署到 github 上面。

1
2
3
4
5
$ hexo init "文件夹名"
$ hexo cl
$ hexo g
$ hexo s
$ hexo d

部署网站需要修改 _config.yml 文件的 deploy 选项

1
2
3
4
$ deploy:
$ type: git
$ repository: git@github.com:tomek-wu/tomek-wu.github.io.git
$ branch: master

还要安装部署程序

1
$ npm install hexo-deployer-git  --save

然后就可以按照下面教程进行了

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment