分享知识,分享快乐

0%

hexo部署到GitHub出现的问题

Hexo出现错误err: Error: Spawn failed

在 hexo d之后,出现如下代码:

1
2
3
4
5
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
FATAL {
err: Error: Spawn failed
1
ssh -T git@github.com

使用上面的命令查看详细错误信息,得到以下结果

ssh: connect to host github.com port 22: Resource temporarily unavailable

2、解决方法

然后我们进入.ssh的配置目录查看,发现ssh目录里少了配置文件config。

找到原因后我们进入.ssh的目录,使用命令“touch config”创建一个配置文件,并写入你github的配置信息。(xxxxx@xx.com是你github的注册邮箱)

1
2
3
4
5
6
Host github.com  
User u8888888888@hotmail.com
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443

现在再使用ssh git@github.com查看与github的连接状态,可能出现错误Bad owner or permissions on

这是因为你创建的配置文件config的权限不够。所以我们需要修改其权限。使用下面命令。

1
sudo chmod 600 config

现在我们再尝试查看连接状态发现已经成功连接。

1
2
3
4
5
6
root@BF100638:~/.ssh# ssh -T git@github.com
The authenticity of host '[ssh.github.com]:443 ([20.205.243.160]:443)' can't be established.
ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[ssh.github.com]:443,[20.205.243.160]:443' (ECDSA) to the list of known hosts.
Hi chinayangze! You've successfully authenticated, but GitHub does not provide shell access.

接下来就可以成功的push你的代码到github了。

参考:https://gugeshenjineng.github.io/2021/07/02/hexo部署到GitHub出现的问题/