我正在尝试访问 Gitlab 服务器以在 Ubuntu 20.10 计算机中克隆一个 repo,但我总是收到消息:
ssh: connect to host gitlab.com port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
所以,我尝试运行命令 ssh -T git@gitlab.com
,但我收到了消息:ssh: connect to host gitlab.com port 22: Network is unreachable
我在另一台装有 Ubuntu 20.04 的计算机上试过,它工作正常。任何人都可以帮助我吗?
最佳答案
在工作环境中,我永远无法将 SSH URL 用于任何公共(public) Git 存储库托管服务(github.com、gitlab.com 等)。
如果问题在其他服务 ( ssh -Tv git@github.com
) 中仍然存在,则您不允许使用 SSH URL。使用 HTTPS URL。
但是如果在同一个网络上,另一台服务器确实可以工作,那么请仔细检查您的特定机器的防火墙规则。一个可能会阻止 SSH,而另一个则不会。
( ufw status verbose
)
关于git - ssh:连接到主机 gitlab.com 端口 22:网络无法访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65299117/