hexo部署在github pages指导
1. 本地安装Hexo环境 (Linux环境,以Debain发行版为例)
1 2 3 4 5
| $apt install nodejs-lts $npm install -g hexo-cli $npm install hexo-deployer-git $hexo g $hexo d
|
2. 本地准备部署工具
1
| $apk install openssh git vim
|
3. 生成ssh公钥
1
| $ssh-keygen -t rsa -C "user.email"
|
4. Github环境准备
设置中先添加ssh公钥
创建github仓库 命名:xxx
克隆仓库到本地目录
复制本地blog目录下的文件到仓库中
修改:’_config.yml’ 文件,末尾添加如下信息:
deploy:
type: git
repo: git@github.com:ccy-master/eiops.git
branch: main (注意:github默认是main分支)
在clone下来的仓库中添加插件,配置githubconfig
1 2 3 4
| $npm install hexo-deployer-git $git config --global core.autocrlf false $git config --global user.email "useremail" $git config --global user.name "username"
|
5. 推送代码到github
1 2 3
| $hexo clean $hexo g $hexo d
|
6. 前往github 仓库中的设置配置git pages页面,
选择要显示的分支保存即可
注意:仓库属性为public 公开的才能提供页面服务,private 私有仓库不能显示,每改变一次仓库属性,需要重新配置git pages。
Love life, like to study, keep improving technology