报错信息
Error: Spawn failed
at ChildProcess.<anonymous> (D:\StudyMaterials\8_FileManagement\testBlog\blog\node_modules\hexo-util\lib\spawn.js:51:21)
at ChildProcess.emit (events.js:314:20)
at ChildProcess.cp.emit (D:\StudyMaterials\8_FileManagement\testBlog\blog\node_modules\cross-spawn\lib\enoent.js:34:29)
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
方法一:
先检查一下自己的ssh公钥有没有连上github,代码如下
ssh -T git@github.com
我的问题就是出现在这里,结果一直连接不上,图片如下
去问学长之后才知道是被墙了,需要开代理或加速服务.开了之后再去重新生成ssh,填到你的github上面去,最后网站就能正常打开了.
生成ssh公钥的步骤:
- 首先打开你的git bash(可以在win键里面搜到),输入以下代码,yourname是你的github的账户名,youremail是你注册邮箱.
git config --global user.name "yourname"
git config --global user.email "youremail"
- 然后输入以下代码生成公钥,一路回车
ssh-keygen -t rsa -C "youremail"
然后就可以在你当前的这个目录下生成一个.ssh的文件,打开它,里面会有一个id_rsa.pub的文件,里面的内容就是我们需要的东西.
3.接着来到我们的github界面,点击settings设置界面,找到SSH and GPG keys的设置选项,点击New SSH key,把你的id_rsa.pub里面的信息复制进去。
4.最后在gitbash中,查看是否成功
ssh -T git@github.com
方法二:
可以你编辑你的_config.yml文件crtl +F找到deploy的地方,将
deploy:
type: git
repo: https://github.com/yourname/yourname.github.io.git
branch: master
修改为(前一个yourname是你github的用户名,后一个是你的仓库名)
deploy:
type: git
repo: git@github.com:yourname/yourname.github.io.git
branch: master
方法三:
可以在你部署博客的文件里找到.deploy_git和public文件
把它们删除,再在执行git config --global core.autocrlf false
(之前试过几次好像hexo g && hexo d 之后又给下回来了,没什么卵用(个人感觉) )