How to change Git clone URL

This pic is map my using Network.
if PC-A access “” , Then access GitLab top page using port forwarding.
if CentOS7-Router get access port 48080, forward

I can git clone using this url "$USER/$REPO_NAME.git "
But input tag (id=project_clone) in my project page (Line 463) teach me this url " http://SAMPLE/$USER/$REPO_NAME.git " …(1)
Of cource , i can’t access using (1) URL.

Further, I build this system in School. so that I can’t record DNS server.

Namely, i want to rewrite input tag (id=project_clone) in my project page .


Sorry my English is not good.

Did you try changing “external_url” value in /etc/gitlab/gitlab.rb file? Value of this setting is used to show value of url in the project page.

Yes. I changed. but when I changed “external_url” , web page shows me 500 error .
Of cource , I carried out gitlab-ctl reconfigure and gitlab-ctl restart .

Maybe I think , if Gitlab is changed “external_url” to “” , it is trying to send all packet to “external_url” .
But , the “external_url” is , so it isn’t able to send packet .
so that it show me 500 error.

And , gitlab.yml is rewrited by “host:HOSTNAME and port:80” when I carried out gitlab-ctl reconfigure.

Have you solved this problem?

  • external_url should be set to the root of your domain.
  • gitlab_shell_ssh_port should be set to the port you want to use.
  • gitlab_ssh_host should be set to the host you want to use, i.e

Any solution or workaround for this problem ?

+1 Would definitely like an override for this. I am also facing similar issues to OP and would like to be able to manually define the clone url.

You should change the host port and forward at the same time. For example, I deploy gitlab (by docker) on my ubuntu( using the port 180. If I want the clone url is in which there exits port, I must change the nginx listen port (in the docker) from 80 into 180. Because gitlab-docker defaultly use the port 80 to access the repo.

So how to change the default port in docker?

  1. Find the gitlab.rb config and change it:
external_url ''

nginx['listen_port'] = 180
  1. docker port map is

Must rember that the host port must be the same as the port in the gitlab-docker