Origine
Origine

Reputation: 49

Change GitLab SSH host

I installed GitLab a little while ago using the Omnibus package.

When I create projects using the Gitlab web UI everything works fine.

What I would like to change is the SSH hostname displayed on the top of the project's page.

For example, my actual host name is "git@xxxx:group/repo.git", and I would like it to be "git@yyyy:group/repo.git".

I have changed the "host" configuration in my config/gitlab.yml and the hostname in /etc/hostname and then run gitlab-ctl reconfigure" but the SSH hostname is still the same.

Upvotes: 2

Views: 9117

Answers (2)

bitminer
bitminer

Reputation: 81

See:

https://github.com/sameersbn/docker-gitlab#available-configuration-parameters

GITLAB_SSH_HOST The ssh host. Defaults to GITLAB_HOST

It is located in the /etc/docker-gitlab/runtime/env-defaults file

At a terminal in the docker container:

grep SSH_HOST /etc/docker-gitlab/runtime/env-defaults                                                                                                                                              
GITLAB_SSH_HOST=${GITLAB_SSH_HOST:-$GITLAB_HOST}

Here you could change: -$GITLAB_HOST to -myhost.wherever.com

or you could change the default for GITLAB_HOST from "localhost"

:/home/git/gitlab# grep _HOST /etc/docker-gitlab/runtime/env-defaults                                                                                                                                                 
GITLAB_HOST=${GITLAB_HOST:-localhost}       

to

GITLAB_HOST=${GITLAB_HOST:-myhost.wherever.com}

No matter how many time you change the

config/gitlab.yml

it will overwrite the value with thoes from env-defaults or the docker run --env 'GITLAB_HOST=myhost.wherever.com'

You can also use a .env file and --env-file at the docker run:

https://docs.docker.com/engine/reference/commandline/run/#set-environment-variables--e-env-env-file

Upvotes: 0

VonC
VonC

Reputation: 1323593

The issue 1875 details what need to be done in order to update the hostname:
(it was referenced from the more recent issue 8396)

Open up config/gitlab.yml and there are a couple places where it says localhost. You can do a search to make sure you get them all.

The first one is towards the top.

web:
host:

The second one is towards the bottom (this is the one that will impact the path)

git:
path:

Then restart gitlab

service gitlab stop; service gitlab start

Turned out that I needed to run

bundle exec rake gitlab:app:status RAILS_ENV=production

in the /home/gitlab/gitlab folder as user gitlab
AND
(I don't know if this was necessary) I changed the order of the 127.0.0.1 line in /etc/hosts from:

127.0.0.1 localhost gitlab gitlab.domain.com
TO
127.0.0.1 gitlab.domain.com gitlab localhost

Upvotes: 2

Related Questions