部署hexo

安装git

安装node.js

1
2
3
4
5
6
7
npm install -g hexo-cli

hexo init 安装目录

cd 安装目录

npm install

配置_config.yml文件

1
2
3
4
5
deploy:
type: git
repo: https://github.com/name/name.github.io.git # GitHub仓库
branch: main # 分支
message: 123 # 自定义此次部署更新的说明,可不写

GitHub推送部署

生成密钥

1
2
3
4
5
6
git config --global user.email "@qq.com"
git config --global user.name "name"

ssh-keygen -t rsa -C "@qq.com"

#复制生成的id_rsa.pub文件到GitHub

开始推送

1
2
3
4
5
6
7
8
#安装插件
npm install hexo-deployer-git

#初始化 git 仓库
git init

#推送
hexo d # hexo deploy的缩写

#遇到的问题
GitHub被墙

1
2
3
4
5
6
7
8
9
10
11
自己的梯子在本地的代理地址及端口号,一般为127.0.0.1:xxxx;
关闭各种国产杀毒、清理软件,启动梯子;
打开终端,依次输入:
git config --global http.proxy http://127.0.0.1:xxxx
git config --global https.proxy https://127.0.0.1:xxxx

hexo d 即可部署;

最后取消代理,依次输入:
git config --global --unset http.proxy
git config --global --unset https.proxy