hexo+butterfly提交GitHub过程中出现Error:Spawn failed,该如何解决?如图所示:

使用GitHub的443端口

22端口可能被防火墙屏蔽了,可以尝试连接GitHub的443端口。

这个解决方案的思路是:给~/.ssh/config文件里添加如下内容,这样ssh连接GitHub的时候就会使用443端口。如果~/.ssh目录下没有config文件,手动新建一个即可。

1
2
3
Host github.com
Hostname ssh.github.com
Port 443

验证是否成功

修改完~/.ssh/config文件后,使用ssh -T [email protected]来测试和GitHub的网络通信是否正常。

1
2
3
4
5
6
$ ssh -T [email protected]
The authenticity of host '[ssh.github.com]:443 ([20.205.243.160]:443)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This host key is known by the following other names/addresses:
~/.ssh/known_hosts:1: github.com
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

输入yes即可,如果提示Hi xxxxx! You've successfully authenticated, but GitHub does not provide shell access. 就表示一切正常了。

1
2
Warning: Permanently added '[ssh.github.com]:443' (ED25519) to the list of known hosts.
Hi LUCKYLIYONGHHUI! You've successfully authenticated, but GitHub does not provide shell access.

参考来源:坑:ssh: connect to host github.com port 22: Connection refused - 知乎