github搭建Hexo博客过程
准备工作
- 安装git。
- 安装Node.js。
- 安装Hexo。
检查:
1 2 3
| $ hexo -v $ git --version $ node -v
|
- 安装hexo依赖
1 2
| $ npm install --save hexo-deployer-git
|
配置ssh-key
1 2 3 4 5 6 7 8 9 10
| User@LAPTOP-TQ97MGKO MINGW64 ~/Desktop $ cd ~/.ssh/
User@LAPTOP-TQ97MGKO MINGW64 ~/.ssh $ pwd /c/Users/User/.ssh
User@LAPTOP-TQ97MGKO MINGW64 ~/.ssh $
|
- 配置ssh。
1 2
| $ ssh-keygen -t rsa -C "Github邮件地址" -> 连续三次回车
|
- 将.ssh文件夹下的id_rsa.pub内的内容全部复制到github主页个人设置里面的Settings->SSH and GPG keys->New SSH key中。
- 测试是否成功
1 2
| $ ssh -T git@github.com
|
- git config设置自己的用户名、邮箱。
1 2 3
| $ git config --global user.name "aaaa" $ git config --global user.email "bbbb"
|
- 初始化
- 自选主题(Butterfly),在Hexo根目录中
1 2 3 4
| git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly npm install hexo-renderer-pug hexo-renderer-stylus --save npm install hexo-deployer-git --save
|
并将_config.yml中的theme改成butterfly.
上传
创建repository,名字选wbohan.github.io,Add a README file.
然后在config.yml中修改deploy:
1 2 3 4 5
| deploy: type: 'git' repository: git@github.com:aaaa/aaaa.github.io.git branch: main
|
Hexo g -d即可上传Blog.