已解决
我将以前那种方式
git clone ssh://[email protected]:KyleBing/iphone.git iphone-vue
改成
git clone ssh://[email protected]:443/KyleBing/iphone.git iphone-vue
是可行的。
但其实有更方便的方法。
只需要在 ~/.ssh/config 中添加以下配置,以前的项目就都能正常使用了。
Host github.com
Hostname ssh.github.com
Port 443
User git
官方说明文档:
https://docs.github.com/en/authentication/troubleshooting-ssh/using-ssh-over-the-https-port
# 以这种方式使用是可以的,但不方便。
Kyle@Kyles-mbp tools % git clone ssh://[email protected]:443/KyleBing/iphone.git iphone-vue
Cloning into 'iphone-vue'...
remote: Enumerating objects: 1483, done.
remote: Counting objects: 100% (224/224), done.
remote: Compressing objects: 100% (152/152), done.
remote: Total 1483 (delta 148), reused 141 (delta 72), pack-reused 1259
Receiving objects: 100% (1483/1483), 6.00 MiB | 2.79 MiB/s, done.
Resolving deltas: 100% (936/936), done.
# 其实只需要添加关于 github 的 ssh 配置
Kyle@Kyles-mbp tools % vi ~/.ssh/config
# 就能测试验证成功
Kyle@Kyles-mbp tools % ssh -T [email protected]
Hi KyleBing! You've successfully authenticated, but GitHub does not provide shell access.
# 之前的项目也能正常使用了。
谢 v 友解答