在 HTTPS 使用 SSH 连接 GitHub

Posted by Yun on Wed, Aug 9, 2023

众所周知,我们访问 GitHub 时,若因某些原因 22 SSH 端口被干扰,那么我们将无法正常使用 Git 的各种操作访问 GitHub。好在 GitHub 官网提供了一种使用 SSH on HTTPS 的方式进行访问,方法也非常简单。

首先运行:

1ssh -T -p 443 git@ssh.github.com

若访问正常,可以在 ~/.ssh/config 中添加如下配置:

1Host github.com
2    Hostname ssh.github.com
3    Port 443
4    User git

如果不出意外,我们已经可以通过正常域名访问 GitHub 了:

1ssh -T git@github.com

参考链接:在 HTTPS 端口使用 SSH


版权声明:本文遵循 CC BY-SA 4.0 版权协议,转载请附上原文出处链接和本声明。

Copyright statement: This article follows the CC BY-SA 4.0 copyright agreement. For reprinting, please attach the original source link and this statement.