第一步:安装工具,生成本地网页

1.安装Node.js,git等工具

2.进入cmd窗口输入:

1
npm install -g hexo-cli

3.创建本地仓库:随意创建一个文件夹,比如我的的是AAA(方便寻找),在文件夹下右键git bush,输入

1
hexo init

初始化成功再输入

1
hexo g

查看生成网页

1
hexo s

这一步就生成好了一个静态网页http://localhost:4000/

第二步:注册github账号并新建一个仓库(公开),设置ssh登录

1.打开cmd,执行

1
2
git config --global user.name "yourname"
git config --global user.email "youremail"

(你的github用户名和邮箱)

在目录C:\Users\libinbin中,右键git bash输入

1
ssh-keygen -t rsa -C "你的邮箱"

敲几次回车

你的邮箱就会收到一个sshkey的邮件,并且该目录下多了个.ssh,用code打开(其他的也行)复制所有内容到github的SSH and GPG keys中生成一个ssh key

第三步:部署

1.在你的本地仓库中的.config.yml,最后的deploy改为

1
2
3
4
deploy:
type: git
repo: https://github.com/Recallpig/Recallpig.github.io.git
branch: main

仓库改为你的网页地址(中间有空格)

2.在本地仓库根目录中输入

1
npm install hexo-deployer-git --save

2.再执行下面命令

1
2
3
hexo clean
hexo g
hexo d

这样就上传成功了