凤凰山笔记

Hexo博客 Error spawn git ENOENT问题解决

最近win10系统升级,可能由于操作失误,导致以前的word文档和ppt都打不开了,这很耽误工作,所以只能重装系统。

今天想更新下博客的时候,从新安装了下hexo,因为博客有备份所以有恃无恐,但是当运行hexo d命令进行发布的时候突然就报错了:

以下是比较详细的报错信息:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
INFO  Deploying: git
INFO Clearing .deploy_git folder...
INFO Copying files from public folder...
'git' �����ڲ����ⲿ���Ҳ���ǿ����еij���
�������ļ�
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: spawn git ENOENT
at notFoundError (D:\workspace\GitHub\hexo_blog\node_modules\hexo-deployer-git\node_modules\hexo-util\node_modules\cross-spawn\node_modules\cross-spawn-async\lib\enoent.js:8:11)
at verifyENOENT (D:\workspace\GitHub\hexo_blog\node_modules\hexo-deployer-git\node_modules\hexo-util\node_modules\cross-spawn\node_modules\cross-spawn-async\lib\enoent.js:43:16)
at ChildProcess.cp.emit (D:\workspace\GitHub\hexo_blog\node_modules\hexo-deployer-git\node_modules\hexo-util\node_modules\cross-spawn\node_modules\cross-spawn-async\lib\enoent.js:30:19)
at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
FATAL spawn git ENOENT
Error: spawn git ENOENT
at notFoundError (D:\workspace\GitHub\hexo_blog\node_modules\hexo-deployer-git\node_modules\hexo-util\node_modules\cross-spawn\node_modules\cross-spawn-async\lib\enoent.js:8:11)
at verifyENOENT (D:\workspace\GitHub\hexo_blog\node_modules\hexo-deployer-git\node_modules\hexo-util\node_modules\cross-spawn\node_modules\cross-spawn-async\lib\enoent.js:43:16)
at ChildProcess.cp.emit (D:\workspace\GitHub\hexo_blog\node_modules\hexo-deployer-git\node_modules\hexo-util\node_modules\cross-spawn\node_modules\cross-spawn-async\lib\enoent.js:30:19)
at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)

搜索了很久,说由于git安装的有问题或者git环境变量没有配置,但是重装过几次git,并且从新配置了环境变量也是没有效果,报错是一样的。

最后看到有人说要用gitbash执行可以解决这个问题,所以打开git shell执行了下 hexo d,果然发布成功…

所以这个问题的解决方案就是gitbash执行 hexo的发布命令

同时碰到另外一个问题:

1
2
3
4
5
6
7
Please make sure you have the correct access rights
and the repository exists.
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: Warning: Permanently added 'git.coding.net,61.133.64.67' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
....

这个主要是重装系统后coding.net的公钥没有重新配置,如果您也遇到这个问题的话,请查看我以前的这篇文章将hexo博客(github pages)同时同步托管到github和coding.net,解决百度不收录问题从新配置下coding.net上面的公钥即可

cloudroc wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!
很惭愧,只做了些微小的工作,您的支持将鼓励我继续努力创作!