启用通过 HTTPS 的 SSH 连接

3 min read

如果您能在端口 443 上通过 SSH 连接到 [email protected],则可以覆盖您的 SSH 设置以强制与 GitHub.com 的任何连接均通过该服务器和端口运行。

要在 SSH 配置文件中设置此设置,请在 ~/.ssh/config 编辑该文件,并添加以下部分:

Host github.com
Hostname ssh.github.com
Port 443
User git

您可以通过再次连接到 GitHub.com 测试此项是否有效:

$ ssh -T [email protected]
> Hi username! You've successfully authenticated, but GitHub does not
> provide shell access.