操作方法

1.在本地搭建Node.jsGit环境, Github建立一个你的用户名.github.io的仓库
2.npm install hexo-cli -g --registry=https://registry.npm.taobao.org
3.cd ../ hexo init blog(将hexo安装在一个名叫blog的文件夹中)
4.ssh-keygen -t rsa -C "Github邮箱" //此处三连
5.提取.ssh/id_rsa.pubGithub/settings/SSH keys 添加
6.编辑_config.yml

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://<Github 用户名>.github.io
...
...
文末添加
deploy:
  type: git
  repo: [email protected]:<Github 用户名>/<用户名.github.io.git>
  branch: master

7.在%USERPROFILE%下创建一个.gitconfig的文件

[user]
    name = GitHub用户名
    email = 你的GitHub邮箱

8.使用ssh -T [email protected]检测连接性

Node最好使用Node.js 12.x的不然可能会造成无法预知的后果

常用指令

hexo clean 清理缓存
hexo s 本地预览 127.0.0.1:4000
hexo g -d 推到GitHub上去

参考阅读

在Github上部署Hexo(纯白教程)