当我尝试通过ssh连接github时,有时会卡在debug1: Connecting to github.com port 22.
上。当我尝试通过git push
连接github时,也会发生同样的情况。问题是有时我会得到连接,但很少。可能30次尝试中我只得到一次。
我尝试了不同的端口,没有改善。我检查了git配置,似乎很好。
我的.ssh/配置
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
我的etc/ssh/配置
# lots of uncommented lines... then line 48:
Host *
SendEnv LANG LC_*
ssh -vvvT git@github.com
的输出
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/alucca/.ssh/config
debug1: /Users/alucca/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to github.com port 22.
谢谢你的建议。
2条答案
按热度按时间lvmkulzt1#
假设您无法使用HTTP URL,您可以尝试看看using Using SSH over the HTTPS port是否是您的情况的可能解决方法。
如果这样做有效,您可以在
~/.ssh/config
中添加slmsl1lt2#
问题
在我的案例中,我也犯了同样的错误:运行
ssh -T git@github.com
时在以下位置卡住:我想这可能是OpenSSH中的一个bug,但我有另一台机器,它有相同的macOS版本和OpenSSH,没有这个问题。
原因
我当时使用的是小飞贼,由于某种原因,它阻止了到GithubIdeComm的SSH流量。我进入小飞贼并启用了它。
这里有一个类似的www.example.com的截图gitlab.com。我也必须为gitlab.com修复它。
溶液
单击Little Snitch中的勾号,如屏幕截图所示。