简体   繁体   English

Gitlab CE git clone无法通过ssh运作

[英]Gitlab CE git clone not works via ssh

I had Installed gitlab ce in docker. 我已经在docker中安装了gitlab ce。 I want to make git clone from server via ssh. 我想通过ssh从服务器制作git clone。 I set port 3000 in gitlab config. 我在gitlab配置中设置了端口3000。 When i try to make git clone i had next: git clone ssh://git@git.site.com:3000/pm/site-crm.git Cloning into 'site-crm'... ssh: connect to host git.site.com port 3000: Connection refused fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. 当我尝试制作git clone时,我接下来要做的是: git clone ssh://git@git.site.com:3000/pm/site-crm.git Cloning into 'site-crm'... ssh: connect to host git.site.com port 3000: Connection refused fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. git clone ssh://git@git.site.com:3000/pm/site-crm.git Cloning into 'site-crm'... ssh: connect to host git.site.com port 3000: Connection refused fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. What else i have to do? 我还要做什么? Thanks. 谢谢。

Check if the SSH port forwarding described in docker-gitlab issue 38 is still valid: 检查docker-gitlab问题38中描述的SSH端口转发是否仍然有效:

Forward some other port on the host to port 22 of the container and use the GITLAB_SHELL_SSH_PORT configuration option to specify the forwarded port to the gitlab application so that the clone urls reflect this. 将主机上的其他一些端口转发到容器的端口22,并使用GITLAB_SHELL_SSH_PORT配置选项指定转发到gitlab应用程序的端口,以便克隆url反映出来。

For example, add -p 3000:22 -e "GITLAB_SHELL_SSH_PORT=3000" to the docker run command. 例如,将-p 3000:22 -e "GITLAB_SHELL_SSH_PORT=3000"-p 3000:22 -e "GITLAB_SHELL_SSH_PORT=3000" docker run命令。
Now you will notice that the ssh clone urls in the gitlab server will change to the form ssh://git@git.local.host:3000/docker/docker-gitlab.git . 现在您会注意到gitlab服务器中的ssh克隆url将更改为ssh://git@git.local.host:3000/docker/docker-gitlab.git

This is still mentioned in this 2017 blog post , which described another approach. 2017年的博客文章中仍然提到了这一点,其中描述了另一种方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM