首页 > 解决方案 > gitlab - 试图克隆一个 repo 给出网络不可用的错误

问题描述

我正在尝试从我们的内部 gitlab 服务器克隆一个 repo。

我正在运行 Windows 10 并使用 ubuntu 子系统。我有 putty 代理正在运行......并且我已经设置了我的 bash 环境,以便一旦我启动 bash,我的密钥就会被加载,所以我只需要这样做来登录远程服务器:

jj@DESKTOP-123:/mnt/c/Users/$ whoami
jj

jj@DESKTOP-123:/mnt/c/Users/$ ssh -A root@test.mydomain.com
Warning: Permanently added 'test.mydomain.com,1.1.1.1' (ECDSA) to the list of known hosts.
Linux test.mydomain.com

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Jul  2 10:52:31 2020 from 2.2.2.2
root@testserver:~#

在 gitlab 上,在我的个人资料/头像下,我将我的公钥添加到 ssh 密钥部分。然后我尝试像这样从ubuntu上的bash连接

jj@DESKTOP-123:/mnt/c/Users/jj/source/repos/gitlab$ git clone -v git@mygitlabserver:team/documentation.git
Cloning into 'documentation'...
ssh: connect to host mygitlabserver port 22: Resource temporarily unavailable
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我还尝试以“jj”或“root”而不是“git”用户身份连接。

我不确定我错过了什么/做错了什么。

标签: gitsshgitlabgit-clone

解决方案


WSLissue 2278所示,错误消息port 22: Resource temporarily unavailable通常指向防火墙问题:

这样做:sudo ufw allow ssh或者,如果您想具体了解 ssh port(22),请执行此操作sudo ufw allow 22

检查防火墙是否正确添加:sudo ufw status.

当您sudo ufw enable忘记添加 ssh 或端口 22 防火墙时,实际上会发生这种情况。


推荐阅读