git - ssh:连接到主机 gitlab.com 端口 22:网络无法访问

标签 git ssh gitlab ssh-keys public-key

我正在尝试访问 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/

相关文章:

git - 我如何告诉 github 我从我的笔记本电脑推送了所有提交?

java - JSCH 的奇怪行为

php - ssh2_auth_pubkey_file 获取错误回调返回错误(PHP 7.4,Ubuntu 20)

linux - 自动化命令行应用程序的集成测试

docker - 使用 Docker 为 Ci 和 Runners 安装 Gitlab CI,并在重启后使其持久化

git - Visual Studio git clone 始终对文件使用 LF

node.js - 在 travis 上运行 child_process.exec 失败,而不是在本地

docker - 将 Docker 镜像从 Gitlab 的私有(private) Docker 注册表部署到 Openshift

visual-studio - 无法访问gitlab : SSL certificate has expired

php - 将应用程序部署到 heroku 时找不到 Procfile