Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab with non-standard SSH port (on VM with Iptable forwarding)

My gitlab is on a virtual machine on a host server. I reach the VM with a non-standard SSH port (i.e. 766) which an iptable rule then forward from host:766 to vm:22.

So when I create a new repo, the instruction to add a remote provide a mal-formed URL (as it doesn't use the 766 port. For instance, the web interface give me this:

Malformed

git remote add origin [email protected]:group/project.git

Instead of an URL containing :766/ before the group.

Wellformed

git remote add origin [email protected]:766/group/project.git

So it time I create a repo, I have to do the modification manually, same for my collaborator. How can I fix that ?

like image 313
Édouard Lopez Avatar asked Aug 29 '13 17:08

Édouard Lopez


People also ask

What port does GitLab use for SSH?

GitLab.com runs a second SSH server that listens on the commonly used port 443 , which is unlikely to be firewalled.

What ports does GitLab use?

Exposing Ports To use your private GitLab server with CodeFlow, you will need a publicly reachable endpoint with ports 22 and 443 open to the internet. We require port 22 to clone your repository to run our analysis and port 443 for status and clone requests.

What port does SSH use?

By default, the SSH server still runs in port 22.


1 Answers

In Omnibus-packaged versions you can modify that property in the /etc/gitlab/gitlab.rb file:

gitlab_rails['gitlab_shell_ssh_port'] = 766 

Then, you'll need to reconfigure GitLab:

# gitlab-ctl reconfigure 

Your URIs will then be correctly displayed as ssh://[email protected]:766/group/project.git in the web interface.

like image 103
Peque Avatar answered Nov 02 '22 09:11

Peque