4

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.

1

3 Answers 3

7

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

5

It's solved.

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

gitlab_rails['gitlab_host'] = 'gitlab.example.com'
1
  • 1
    I concur, worked for me too with the omnibus package for Debian.
    – Adambean
    Dec 27, 2018 at 10:53
0

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.