执行以下命令
hexo cl && hexo generate && hexo server
假如报以下错误:
warning: in the working copy of 'tags/飞牛/index.html', LF will be replaced by CRLF the next time Git touches it
On branch master
nothing to commit, working tree clean
ssh: connect to host github.com port 22: Connection refused
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Error: Spawn failed
at ChildProcess.<anonymous> (D:\blog\lele\node_modules\hexo-deployer-git\node_modules\hexo-util\lib\spawn.js:51:21)
at ChildProcess.emit (node:events:524:28)
at cp.emit (D:\blog\lele\node_modules\cross-spawn\lib\enoent.js:34:29)
at ChildProcess._handle.onexit (node:internal/child_process:293:12)
注意上边ssh: connect to host github.com port 22: Connection refused
这个错误,然后执行下边的命令
ssh -vT [email protected]
假如输出:
$ ssh -vT [email protected]
OpenSSH_9.0p1, OpenSSL 1.1.1o 3 May 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [::1] port 22.
debug1: connect to address ::1 port 22: Connection refused
debug1: Connecting to github.com [127.0.0.1] port 22.
debug1: connect to address 127.0.0.1 port 22: Connection refused
ssh: connect to host github.com port 22: Connection refused
从上面的信息马上就发现了诡异的地方,连接http://github.com的地址居然是::1
和127.0.0.1
。前者是IPV6的localhost地址,后者是IPV4的localhost地址,这说明错误的原因是DNS解析被污染了,修改windows的host文件即可解决,host文件路径在C:\Windows\System32\drivers\etc
,进去找到host用记事本打开,添加github对应的dns即可解决
20.205.243.166 github.com
github对应的dns可以去下边这个网站去找
修改后保存,再允许下边代码可解决
hexo cl && hexo generate && hexo server
参考教程
{% link 解决ssh: connect to host github.com port 22: Connection refused, https://www.cnblogs.com/Archer314/p/14641310.html, /img/niu.webp %}