Unable to git clone from self-hosted GitLab instance with custom port 6022

I am trying to clone a Git repository from a self-hosted GitLab instance that is running on a custom port 6022, but I am unable to do so. Here’s what I’ve tried so far:

  • I have confirmed that the GitLab instance is up and running on port 6022 by checking it with terminal command lsof, netstat, etc.

  • I have created an SSH key and added it to my GitLab account.

  • I have tried to clone the repository using the SSH URL provided by
    GitLab, like this:

    git clone git@mygitlabinstance.com:6022/my-username/my-repo.git
  • I have also tried to specify the custom port using the -p flag, like this:

    git clone -p 6022 git@mygitlabinstance.com:my-username/my-repo.git

However, both of these methods result in the following error:

Copy code
Cloning into 'my-repo'...
ssh: connect to host mygitlabinstance.com port 6022: Connection refused
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

how can I clone the repository from my self-hosted GitLab instance on port 6022?

this is my docker-compose.yml

version: '3.7'
    image: 'gitlab/gitlab-ee:latest'
    restart: always
    hostname: 'gitlab.example.com'
    container_name: gitlab-ee
        #external_url 'https://gitlab.example.com'
        #external_url 'http://localhost:80'
        gitlab_rails['smtp_enable'] = true
        gitlab_rails['smtp_address'] = "***"
        gitlab_rails['smtp_port'] = 587
        gitlab_rails['smtp_user_name'] = "developer@*.com"
        gitlab_rails['smtp_password'] = "**"
        gitlab_rails['smtp_domain'] = "**.com"
        gitlab_rails['smtp_authentication'] = "login"
        gitlab_rails['smtp_enable_starttls_auto'] = true
        gitlab_rails['smtp_tls'] = false
        gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
        gitlab_rails['gitlab_shell_ssh_port'] = 6022
        nginx['redirect_http_to_https'] = true
        nginx['ssl_certificate'] = "/etc/gitlab/ssl/fullchain.pem"
        nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/privkey.pem"
        nginx['ssl_dhparam'] = "/etc/gitlab/ssl/dhparams.pem"
        # HTTPS Setup
        #letsencrypt['enable'] = false
        #external_url 'https://gitlab.example.com'
        #gitlab_rails['gitlab_https'] = true
        #gitlab_rails['gitlab_port'] = 443
      - '8081:80'
      - '8443:443'
      - '6022:22'
      - '587:587'
      - '$GITLAB_HOME/config:/etc/gitlab'
      - '$GITLAB_HOME/logs:/var/log/gitlab'
      - '$GITLAB_HOME/data:/var/opt/gitlab'
      - '$GITLAB_HOME/config/ssl:/etc/gitlab/ssl'