Operations 3 min read

Why Your GitLab SSH Clone Uses a Different Port—and How to Fix It Quickly

This guide explains why a GitLab instance may display an unexpected SSH clone URL, how to locate the misconfigured ssh_port setting, and provides step‑by‑step instructions to adjust the SSH daemon port, update GitLab’s configuration, and restart services to resolve the issue.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Why Your GitLab SSH Clone Uses a Different Port—and How to Fix It Quickly

Problem: GitLab SSH clone uses a different port than other servers

The author noticed that the SSH URL displayed by GitLab differed from the usual format, causing confusion.

Solution

Searching the configuration for the keyword ssh_port revealed the cause.

After changing the SSH daemon port, the configuration looks like the following:

Before the change, the configuration was:

Steps

1. Modify the Port entry in sshd_config .
service sshd restart
2. Edit /etc/gitlab/gitlab.rb (overrides gitlab.yml). Enable the line and set the port to match the server’s SSH daemon.
gitlab_rails['gitlab_shell_ssh_port'] = 50022
3. Apply the changes.
gitlab-ctl reconfigure
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxServer AdministrationSSHPort Configuration
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.