博客文章多了,某天突然发现,有一个tag点进去404,在本地运行hexo s却正常没有问题。

首先是老传统STFW,但是网络上的相关内容却都是解决tags总页面404的,我却是单独的tag页面丢失,没找到我想要的内容。用实力证明搜索引擎不可靠(笑)。刚好那段时间比较忙,就暂且把这事搁置了。(反正博客也没什么人看)

中间有一天突发奇想,把链接里相关tag的大写改为小写,发现可以访问了。没时间去解决(懒狗不想手动修改每一个tag),于是在Tags页面下写了条评论。

今天闲下来突然想起还有这事。搜索引擎一如既往稳定发挥。怎么办呢?不急,我还有一招——RTFM。找到hexo在Github上的仓库,在Issues里面寻找。果然找到了老前辈的馈赠——BUG反馈:大写开头的标签出现404 · Issue #818 · hexojs/hexo (github.com)

在里面逛了一圈发现是因为git中设置了大小写不敏感。

解决过程

在网上查找修改 git 设置不忽略大小写的方法。(顺便看到了很多因为这个引发的“事故”哈哈)

进入博客文件夹的 git 目录:.deploy_git,修改 .git 文件夹中的配置文件 config,将ignorecase=true 改为 ignorecase=false

清空并重新部署博客。

发现还没有解决,查找到方案:清空部署到 github 上的文件,重新发布:

1
2
3
4
cd .deploy_git
git rm -rf *
git commit -m 'clean all file'
git push

在运行git push时报错,显示如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
git push
fatal: The upstream branch of your current branch does not match
the name of your current branch. To push to the upstream branch
on the remote, use

git push git@github.com:AullChen/AullChen.github.io.git HEAD:main

To push to the branch of the same name on the remote, use

git push git@github.com:AullChen/AullChen.github.io.git HEAD

To choose either option permanently, see push.default in 'git help config'.

To avoid automatically configuring an upstream branch when its name
won't match the local branch, see option 'simple' of branch.autoSetupMerge
in 'git help config'.

按其提示选择第二个git push git@github.com:AullChen/AullChen.github.io.git HEAD部署到远程仓库。

进入博客文件夹,用 hexo 重新生成部署

hexo clean && hexo g -d

问题完美解决!