@Author:CSU张扬
@Email:csuzhangyang@gmail.com or csuzhangyang@qq.com
@我的网站: https://www.faker.top
问题预览:
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
1.1 问题描述
具体错误信息如下:

ssh: connect to host github.com port 22: Connection timed out
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> (F:\Program Files\hexo\node_modules\hexo-util\lib\spawn.js:51:21)
at ChildProcess.emit (events.js:210:5)
at ChildProcess.cp.emit (F:\Program Files\hexo\node_modules\cross-spawn\lib\enoent.js:34:29)
at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
一开始我把目光聚焦在后面的 Error: Spawn failed 上,但是没有学过前端的我并看不懂。
但是,真正的错误是在上面一部分信息里。
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
ssh:连接到主机github.com端口22:连接超时
致命:无法从远程存储库读取。
请确保您具有正确的访问权限,并且存储库存在。
1.2 解决办法
直接暴力解决:重新配置密钥
-
git bash窗口依次输入:(注意:双引号里改为你的Github的名字和邮箱)git config --global user.name "MagicConchCpp"git config --global user.email "csuzhangyang@gmail.com" -
生成新秘钥:
ssh-keygen -t rsa -C "csuzhangyang@gmail.com"选择文件路径,然后遇到下面这个直接回车。
$ ssh-keygen -t rsa -C "csuzhangyang@gmail.com" Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/lenovo/.ssh/id_rsa):文件已经存在,是否重写?输入
y,回车。/c/Users/lenovo/.ssh/id_rsa already exists. Overwrite (y/n)? y然后设置密码什么的,不用管,直接两下回车。
Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /c/Users/lenovo/.ssh/id_rsa. Your public key has been saved in /c/Users/lenovo/.ssh/id_rsa.pub. The key fingerprint is: -
新秘钥保存在
/c/Users/lenovo/.ssh/id_rsa.pub。
打开这个文件,复制其中的的内容。
在github中,打开setting -> SSH and GPG keys。删除原来的,把新的复制进去,即解决。重新执行hexo d。
本文详细解析了在使用GitHub时遇到SSH连接超时的问题,提供了具体的错误信息及解决步骤,包括重新配置密钥和更新SSH公钥。
2146

被折叠的 条评论
为什么被折叠?



