写在前面
在使用GitHub+HEXO搭建个人博客的时候,发现了一个错误,让我纠结了很久,后来发现是说我没有配置邮箱和用户名,后来解决了,记录一下解决方法。
本文使用的东西
都是已经安装过的东西
- win10系统的电脑
- Node.js 12.13.1
- Git 2.24.0
- HEXO 4.0.0
1.报错内容
fatal: unable to auto-detect email address (got '殇雪话诀别@DESKTOP-UJH1NRV.(none)')
error: src refspec HEAD does not match any
error: failed to push some refs to 'https://github.com/nineya/nineya.github.io.git'
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Error: Spawn failed
at ChildProcess.<anonymous> (G:\blog\node_modules\_hexo-util@1.6.0@hexo-util\lib\spawn.js:51:21)
at ChildProcess.emit (events.js:210:5)
at ChildProcess.cp.emit (G:\blog\node_modules\_cross-spawn@7.0.1@cross-spawn\lib\enoent.js:34:29)
at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
2.解决方法
1.在文件浏览器中勾选显示隐藏的项目
2.进入我们博客目录的“.deploy_git.git”子目录,找到config文件。
3.打开config文件,添加以下内容
[user]
email=你的邮箱
name=GitHub用户名
如图:
3.我的问题
虽然问题解决了,但是我还是有疑问,因为在Git Bash中我已经配置过邮箱了,测试也是生效了,HEXO这里就显示没有了。如下图:
在Git Bash中已经生效了
4.总结
问题虽然解决了,但还是留下一些问题,我只是小白。难道是只能通过修改config文件配置用户名和邮箱,我也没有删除或者修改Git Bash中的配置再试试能不能发布,应该也是可以的,知道这个问题的大佬欢迎评论留言,有什么不足的地方请大家不吝指正。