git环境迁移故障处理

 · 2024-1-20 · 次阅读


git代理故障修复

情况描述

回家工作git@github.com 进行代码操作无法进行,hexo部署故障,前几天咕咕的原因是在回家路上。

1
2
3
4
5
6
7
8
9
10
11
12
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> (D:\realworspace\blog\main\node_modules\hexo-deployer-git\node_modules\hexo-util\lib\spawn.js:51:21)
at ChildProcess.emit (node:events:514:28)
at cp.emit (D:\realworspace\blog\main\node_modules\cross-spawn\lib\enoent.js:34:29)
at ChildProcess._handle.onexit (node:internal/child_process:294:12)

修复思路

  1. 更换 ssh host 地址
  2. 更换git的方式用http
  3. deploy.git-log检查 针对问题修复

修复成功

使用GitHub的443端口

1
2
3
4
5
6
7
8
9
10
$ vim ~/.ssh/config
```
# Add section below to it
Host github.com
Hostname ssh.github.com
Port 443
```
$ ssh -T git@github.com
Hi xxxxx! You've successfully authenticated, but GitHub does not
provide shell access.

重新进行几个目前在推进的仓库的拉取和更新成功,hexo博客部署也成功。

其他几个修复方式就没有测试了,看网上大佬们都是成功解决了的。

在此记录下方便后续查询。

这个方案有效的前提是:执行命令ssh -T -p 443 git@ssh.github.com后不再提示connection refused