本地拉取gitlab上的项目(docker+gitlab的配置),报错:fatal: Could not read from remote repository

环境配置:centos7+docker+gitlab

一、出现的问题

ssh配置成功,本地拉取gitlab项目报错

lucky@luckydeMacBook-Pro ~ % git clone git@81ca3f292881:Syw/daas_interface_test.git
Cloning into 'daas_interface_test'...
ssh: Could not resolve hostname 81ca3f292881: nodename nor servname provided, or not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
lucky@luckydeMacBook-Pro ~ %

注:快速的处理方案:将81ca3f292881 改为172.16.58.134:8070(gitlab的地址)即可clone成功

  注意:当gitlab新创建项目时,项目地址会自动获取一个gitlab服务器的IP地址

 

 

二、解决方法:(修改这个IP地址,让其成为正确的IP地址)

1、登录服务器(这里我是自己的虚拟机)

2、打开终端,进入docker容器,在容器中执行执行命令

docker exec -it gitlab1 bash

3、进入到gitlab的配置文件中

cd   /opt/gitlab/embedded/service/gitlab-rails/config

4、修改 gitlab.yml 文件

vim gitlab.yml

 

 注意:若在docker中给gitlab配置了端口,此处也需要添加端口信息

 

5、重启gitlab ,使之生效

gitlab-ctl restart

 

6、查看结果

 

 

 

 

  

  

posted @ 2020-07-09 13:05  Syw_文  阅读(2267)  评论(0)    收藏  举报