【问题标题】:gitlab - trying to clone a repo gives error that network is unavailablegitlab - 尝试克隆 repo 会出现网络不可用的错误
【发布时间】:2020-10-27 21:52:23
【问题描述】:

我正在尝试从我们的内部 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”用户身份连接。

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

【问题讨论】:

  • 文件权限可能吗?这就是我能想到的。 SSH 显然可以正常工作。

标签: git ssh gitlab git-clone


【解决方案1】:

WSL issue 2278所示,错误信息port 22: Resource temporarily unavailable一般指向防火墙问题:

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

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

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

【讨论】:

猜你喜欢
  • 2012-07-14
  • 2022-07-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-10-12
  • 2014-06-06
相关资源
最近更新 更多