Skip to content

Commit 5bc010c

Browse files
committed
Add misc Q&A to appendix
1 parent 916154a commit 5bc010c

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

docs/appendix/misc-qa.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# 杂项问题 Q & A
2+
3+
## 1. GitHub SSH 连接端口被占用问题
4+
5+
### 现象描述
6+
7+
执行任何 GitHub **SSH 版本**的仓库指令(如 `git clone git@github.com:ICS-25Fall-FDU/ICS-25Fall-FDU.github.io.git` )出现以下报错:
8+
9+
```bash
10+
ssh: connect to host github.com port 22: Connection refused
11+
致命错误:无法读取远程仓库。
12+
13+
请确认您有正确的访问权限并且仓库存在。
14+
```
15+
16+
运行 `ssh -t git@github.com` 时,出现报错:
17+
18+
```bash
19+
ssh: connect to host github.com port 22: Connection refused
20+
```
21+
22+
### 问题可能原因
23+
24+
大多数校园网、公司网络会屏蔽 SSH 的 22 端口,但允许 HTTPS(443 端口)。
25+
26+
### 解决方法
27+
28+
修改 SSH 配置文件,将 GitHub 的 SSH 端口从 22 改为 443。
29+
30+
1. 用任意文本编辑器(比如 VSCode , Nano 等)打开 SSH 配置文件 `~/.ssh/config`
31+
2. 在任意处添加以下内容:
32+
33+
```text
34+
Host github.com
35+
Hostname ssh.github.com
36+
Port 443
37+
User git
38+
```
39+
40+
3. 保存文件并退出编辑器。
41+
4. 重试 `ssh -t git@github.com` 指令,应该可以成功连接了。现象:
42+
43+
```bash
44+
Hi {username}! You've successfully authenticated, but GitHub does not provide shell access.
45+
```

0 commit comments

Comments
 (0)