hexo 搭建个人博客

hexo 搭建个人博客的一些问题

在使用hexo搭建博客的时候,会遇到一些问题,我在这里总结一下我遇到的错误和解决方法,希望对你有所帮助。

config配置文件出错

ERROR Deployer not found: git

YAMLException: bad indentation of a mapping entry (104:3)

键值队不对,打开config.xml文件,检查一下报错的地方,是否书写不正确,我遇到的是deploy没有顶住开头写,所以报错,按照正常的书写方式来写就好了

建议直接cv过去

1
2
3
4
deploy:
type: git
repo: git@github.com:smg1205/smg1205.github.io.git # 这里写你创建仓库的ssh
branch: main # 这里大部分是不需要改的,除非你之前在GitHub中将main改成了master,如果改了,那就把这里改成master

连接不上

error: RPC failed; curl 28 Recv failure: Connection was reset fatal: expected flush after ref listing

运行下面语句可以解决

1
git config --global http.sslVerify "false"

fatal: unable to access https://github.com/hexojs/hexo-starter.git/ : Failed to connect to github.com port 443 after 21081 ms: Couldn t connect to server

运行两条语句就可以了,

取消git的http和https代理就可以了 # 取消http代理

1
2
3
git config --global --unset http.proxy

git config --global --unset https.proxy

端口不对

ssh: connect to host github.com port 22: Connection timed out

需要在.ssh文件夹内写一个config配置文件,新建txt文档,复制粘贴下面的语句,然后删去 .txt 后缀

1
2
3
4
5
6
# Default github user self
Host github.com
port 443 # 默认是22端口
HostName ssh.github.com
IdentityFile ~/.ssh/id_rsa

随后输入

1
ssh -T git@github.com

看一下是否链接成功

ssh密钥

这个一般不会报错 ,输入下面语句之后,不管要求你输入什么,只需要敲回车就可以了,如果你之前设置过ssh,会问你是否需要覆盖,敲一个小写y就可以了

1
ssh-keygen -t rsa -C "github的注册邮箱"

hexo init时出现失败

检查一下端口是否修改了,可以看一下端口不对和链接失败


hexo 搭建个人博客
http://example.com/2023/10/25/hexo/
作者
smg
发布于
2023年10月25日
许可协议