hexo+github我遇到的一些坑

1、项目名称

建的项目仓库名称一定要和账号名称一致

项目名称:用户名.github.io

最终的访问方式(ssh为例)git@github.com:用户名/用户名.github.io.git

项目仓库名称头与用户名不一致 无法使用 用户名.github.io这个地址访问。

2、网络环境

因为你懂的的原因,出现网络访问相关问题的时候加相关配置吧。

1
2
git config --global http.proxy 127.0.0.1:7890
git config --global https.proxy 127.0.0.1:7890

7890是你本地已经开好的可以使用的代理端口。

3、无法自动上载到GitHub

我遇到的现象是执行hexo d后

1
2
3
4
5
6
xxxxxxxxx ~/blog (main)
$ hexo d
INFO Validating config

xxxxxxxxx ~/blog (main)
$

无法成功上载到github。

我的做法:

github侧 pages 设置deployment Source - deploy from a Branch

Your GitHub Pages site is currently being built from the /docs folder in the main branch.

**1.**将docs目录设为发布根目录

**2.**在hexo本地项目目录下新建docs文件夹,并将预备发布的public下的文件复制到docs目录

**3.**通过git命令上传至GitHub(GIT环境已经配好并指向目标仓库)

1
2
3
$ git add docs
$ git commit -m docs
$ git push