报错信息如下

1
2
3
4
5
6
7
8
Please make sure you have the correct access rights
and the repository exists.
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Error: Spawn failed
at ChildProcess.<anonymous>
at ChildProcess.emit (node:events:517:28)
at cp.emit
at ChildProcess._handle.onexit (node:internal/child_process:292:12)

这个一般来说是网络问题,可能是魔法没开,或者开了之后仍然推送失败,可以尝试电脑重启之后,先开魔法,再进行推送。

1.如果还不行,看SSH密钥是否过期

1
ssh -T git@github.com

来查看SSH密钥是否成功配置到GitHub.

如果提示 "Permission denied (publickey)",说明 SSH 密钥未配置或未添加到 GitHub,解决办法:

  • 运行 ssh-keygen -t rsa -b 4096 -C "your_email@example.com" 生成 SSH 密钥。
  • ~/.ssh/id_rsa.pub 添加到 GitHub 的 SSH Key。

2. 检查 Hexo 部署配置

打开 _config.yml,找到 deploy 配置,确保格式正确。例如:

1
2
3
4
5
# 在根站点下的_config.yml
deploy:
type: git
repo: git@github.com:your-username/your-repo.git
branch: main

如果你的远程仓库默认分支是 master 而不是 main,或者用的是 HTTPS 地址,需要修改对应的 branchrepo

作者: Yangzy
博客链接: 个人博客