4

问题

当我在 GitLab 中创建存储库时,由于某种原因,它显示了存储库的不同 HTTP URL 和 SSH URL。
例如)

HTTP:http://anotherexample.com/myrepo.git
SSH:git@gitlab.example.com/myrepo.git

我的 gitlab URL 是:https://gitlab.example.com,所以 SSH 正确,HTTP 错误。

anotherexample.com是我设置 DNS 之前服务器的 URL。)


我查看了 /var/opt/gitlab/gitlab-rails/etc/gitlab.yml,然后发现:

# 1. GitLab app settings
# ==========================
host: anotherexample.com
port: 80
https: false

ssh_host: gitlab.example.com

然后我手动更改了这个主机,暂时解决了。

但是,gitlab.yml将在我执行gitlab-ctl reconfigure时更新。


问题
如何在/etc/gitlab/gitlab.rb
中为 HTTP 设置此主机名?

我已经有以下两行:

external_url 'https://gitlab.example.com'
gitlab_rails['gitlab_ssh_host'] = 'gitlab.example.com'

但它似乎不适用于 HTTP url。


我的 GitLab 版本:8.8.3
我的服务器:CentOS 6.8 + nginx 1.10.1


提前致谢。

4

3 回答 3

6

对于像我这样的 URL 完全错误的人,您只需要更新

external_url "http://gitlab.example.com"

进去/etc/gitlab/gitlab.rb然后运行

sudo gitlab-ctl reconfigure

使更改生效。您可以在此处阅读更多官方文档

于 2018-04-19T09:28:05.207 回答
5

解决了。

我刚刚在/etc/gitlab/gitlab.rb中添加了以下行

gitlab_rails['gitlab_host'] = 'gitlab.example.com'
于 2016-07-01T15:37:42.560 回答
0

如果您在 2019 年仍然在这里尝试使其正常工作(例如使用 docker),请在机器上设置主机名(使用 docker 时 /etc/hosts 或 hostnamectl 或 -h)。

于 2019-10-17T13:32:22.570 回答