1. 备份原电脑中如下文件
1
2
3
4
5
6
scaffolds/	#模板文件
source/ #资源文件,主要是文章
themes/butterfly/source/img/ #主题下图片资源夹
_config.butterfly.yml #主题配置文件
_config.yml #配置文件
.gitignore

Hexo更换电脑 01_2021-03-07_11-49-27

Hexo更换电脑 02_2021-03-07_11-50-22

  1. 新电脑上安装Git与Node.js

  2. 安装hexo

    输入命令

    npm install hexo-cli -g

    初始化hexo

    hexok init

    安装依赖包

    npm install

  3. 更换主题

    git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly

  4. 安装插件

1
2
3
4
5
6
1.搜索插件
npm install hexo-generator-search --save
2.字数统计、阅读时长插件
npm i --save hexo-wordcount
3.部署上传插件
npm install hexo-deployer-git --save
  1. 用备份文件替换对应文件

  2. 输入命令hexo s,测试是否正常

    若网页提示缺少 pug&stylus 渲染器,请安装。

    butterfly_2021-03-07_10-44-21

    渲染器安装:

    npm install hexo-renderer-pug hexo-renderer-stylus

  3. 生成SSH,添加到Github

1
2
3
4
5
6
7
8
9
10
1.设置Github用户名与电子邮箱地址
git config --global user.name "yourname"
git config --global user.email "youremail"
2.查看用户名/用户邮箱地址设置,检查是否正确
git config user.name
git config user.email
3.生成SSH
ssh-keygen -t rsa -C "youremail"
4.查看SSH
ssh -T git@github.com
  1. 部署至Github

    hexo g -d