1 情况概述

本人在synology服务器上使用Docker部署了一个gitlab服务器,然后又通过路由器的端口映射实现了在外网的访问,同时使用DNS给局域网找了个域名。
然后通过外网能够访问服务器,并且可以在上面创建项目/仓库。但是有一个问题,在点击gitlab页面的克隆按钮时,获得的http Url是错误的。显示的是容器名字,不是外网访问的域名+端口号。
详情见这里说明:
https://forum.gitlab.com/t/when-doing-clone-repository-on-my-gitlab-server-i-get-the-wrong-http-url-from-the-clone-button/85317

2 解决方案

很简单,在gitlab的文件gitlab.rb中设置如下:

## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
##!
##! Note: During installation/upgrades, the value of the environment variable
##! EXTERNAL_URL will be used to populate/replace this value.
##! On AWS EC2 instances, we also attempt to fetch the public hostname/IP
##! address from AWS. For more details, see:
##! https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
external_url 'http://kevin.synology.me:1081'

解决了!

这里还有另一个解决方法:https://stackoverflow.com/questions/37874086/http-url-for-clone-is-wrong-in-gitlab

gitlab_rails['gitlab_host'] = 'gitlab.example.com'

但我在gitlab.rb文件中没有找到这个标签,也没有试验。大家可以手动加上这个标签,看看是否能解决吧!

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐