解决hexo d FATAL Something’s wrong

上报错信息:

1
2
3
4
5
6
7
8
9
fatal: unable to access 'https://github.com/shenmidadazaoan/shenmidadazaoan.github.io.git/': Failed to connect to github.com port 443 after 2112 ms: Couldn't connect to server
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Error: Spawn failed
at ChildProcess.<anonymous> (C:\Users\zaoan\blog\node_modules\hexo-deployer-git\node_modules\hexo-util\lib\spawn.js:51:21)
at ChildProcess.emit (node:events:518:28)
at cp.emit (C:\Users\zaoan\blog\node_modules\cross-spawn\lib\enoent.js:34:29)
at ChildProcess._handle.onexit (node:internal/child_process:294:12)


原因:在博客根目录下的_config.yml里面有这么个配置

1
2
3
4
5
deploy:
type: git
repo: https://github.com/shenmidadazaoan/shenmidadazaoan.github.io.git
branch: master

因为采用了https方式上传代码导致访问不了或者被拒

这里我推荐采用ssh的git方式上传代码

找到我们网站挂载项目地址例如本人的是:shenmidadazaoan/shenmidadazaoan.github.io: 这是一个基于hexo框架搭建的个人静态博客网站
进去后找到Code选择Local然后选择SSH复制里面的链接,然后把链接复制到_config.yml和_config.butterfly.yml里面的配置里面,如下:

1
2
3
4
deploy:
type: git
repo: git@github.com:shenmidadazaoan/shenmidadazaoan.github.io.git
branch: master