在更新部署信息的时候经常会出现这样类似的报错

1
2
3
4
5
6
Error: Spawn failed
at ChildProcess.<anonymous> (D:\blog\node_modules\.store\hexo-util@2.7.0\node_modules\hexo-util\lib\spawn.js:51:21)
at ChildProcess.emit (node:events:514:28)
at cp.emit (D:\blog\node_modules\.store\cross-spawn@7.0.3\node_modules\cross-spawn\lib\enoent.js:34:29)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)

方案一:

1.删除 .deploy_git 文件夹;

2.输入 git config --global core.autocrlf false
3.然后,依次执行:

1
2
3
hexo clean
hexo g
hexo d

方案二:

1.进入hexo根目录
2.直接把.deploy_gitpublic`直接删除!

3.然后,依次执行:

1
2
3
4
hexo clean
hexo g
hexo d

方案三:

就是在站点配置文件里面**:

deploy:

1
2
3
4
5
6
type: git

repo: git@github.com:SuoXiuYuan/suoxiuyuan.github.io.git

branch: master

然后还会遇到已经显示INFO Deploy done: git 了但是github仓库里还是没更新

我们可以输入上传指令hexo d 或者 hexo g -d 多试几次稍微等等

实在不行

ssh -T git@github.com,使用这个git命令验证是否和GitHub连接成功,如果出现下述错误:

$ ssh -T git@github.com

Hi “你的用户名”! You’ve successfully authenticated, but GitHub does not provide shell access.

即Github不提供shell访问,我们重新用 ssh 的方式设置一下就行了

具体解决方法戳这里

最新版解决方案如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
删除原来的ssh秘钥
点击项目仓库
添加秘钥
一定要按照上面的站点配置文件来!!!!!!!!!!!!!!!!!重点!!!因为已经把原来的网址改为了这种形式!!!!切记!!
之后在博客根目录下打开git bash
分别执行下面的命令:
yourname是你的名字

youremail是你的邮箱
$ git config --global user.name "yourname"
$ git config --global user.email "youremail"

然后安装上传插件
cnpm install hexo-deployer-git --save
在博客根目录下打开git bash,执行下面的命令就可以上传了
hexo g -d


完成之后,以后大概率只需要输入hexo g -d就不会出现报错了