3
votes

PROBLEM:

When I create a repository in GitLab, it shows different HTTP URL and SSH URL of the repository by some reason.
eg)

HTTP: http://anotherexample.com/myrepo.git
SSH: [email protected]/myrepo.git

My gitlab URL is: https: //gitlab.example.com, so SSH is correct and HTTP is wrong.

( anotherexample.com is the URL of my server before I set DNS.)


I looked at /var/opt/gitlab/gitlab-rails/etc/gitlab.yml, then found:

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

ssh_host: gitlab.example.com

then I manually changed this host and it's temporarily solved.

However, gitlab.yml will be updated when I do gitlab-ctl reconfigure.


QUESTION:
How can I set this host name for HTTP in /etc/gitlab/gitlab.rb
?

I've already had two lines below:

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

but it seems not work for HTTP url.


My GitLab version : 8.8.3
My server : CentOS 6.8 + nginx 1.10.1


Thanks in advance.

3
How is this a programming question? Please, see this page in order to see the appropriate topics for StackOverflow! :)radu-matei

3 Answers

5
votes

For people like me who had entirely the wrong URL you will need to update just

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

in /etc/gitlab/gitlab.rb and then run

sudo gitlab-ctl reconfigure

for the changes to take effect. You can read more in the official docs here

4
votes

It's solved.

I just added the line below in /etc/gitlab/gitlab.rb

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

If you are still here in 2019 trying to get this to work (with docker for example) set the hostname on the machine (/etc/hosts or hostnamectl or -h when using docker).