跳转到内容

通过HTTPS端口使用SSH访问远程git仓库

测试是否可以通过 HTTPS 端口 SSH:

Terminal window
> ssh -T -p 443 [email protected]
Hi ZuoAoyu! You've successfully authenticated, but GitHub does not provide shell access.

克隆仓库,如:git clone ssh://[email protected]:443/YOUR-USERNAME/YOUR-REPOSITORY.git

添加远程仓库地址,如:git remote add origin [email protected]:ZuoAoyu/wxWidgetsVSCodeTemplate.git

修改远程仓库地址,如:git remote set-url origin ssh://[email protected]:443/ZuoAoyu/wxWidgetsVSCodeTemplate.git

如果要让所有的github仓库都通过 HTTPS 端口使用 SSH 连接,需要修改配置~/.ssh/config,添加:

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

测试:

> Hi USERNAME! You've successfully authenticated, but GitHub does not
> provide shell access.

参考