Skip to content

cloning to gitlab instance on custom ssh port #213

@ndom91

Description

@ndom91

Expected behavior

Clone successful, working dir created

Actual behavior

Project Gitlab URL: git@git.xyz.de:2424/abc/xyz.git

Initialized empty Git repository in ./.git/
ssh: connect to host git.newtelco.de port 22: Connection refused
fatal: The remote end hung up unexpectedly

According to my googling, many have suggested creating a ~/.ssh/config file to create an ssh shortcut, I did this, however php-censor does not seem to recognize this when executing its ssh git pull. I thought it might have been because it is being executed as the nginx user, so I put this config file also in the home dir of nginx (/var/lib/nginx/.ssh/config), but that wasn't recognized either. Contents of my .ssh/config file are:

Host git.xyz.de
        hostname git.xyz.de
        port 2424
        User git
        PubKeyAuthentication yes
        IdentityFile /home/xyz/.ssh/id_xyz

Then I tried to insert the port into the project URL, but that still wasn't recognized / applied either. It still always said ssh: connect to host git.newtelco.de port 22: Connection refused. I tried the following URL variations:

  • git@git.xyz.de:2424/abc/xyz.git
  • git@git.xyz.de:2424:abc/xyz.git
  • git@git.xyz.de:abc/xyz.git:2424

Has anyone successfully pulled from a custom ssh port? This only applies to self-hosted Gitlab instances as well I guess since Github and Bitbucket and the like aren't going to be changing their SSH ports.. haha

EDIT:
For example, when using git@git.xyz.de:2424/abc/xyz.git

We get the following output (scroll all the way to the right to see full attempted URL):

Command: export GIT_SSH="/tmp/sh_FSkiLt" && cd .. && git clone --recursive  -b "master" "git@git.xyz.de:2424/abc/xyz.git" "./"
Initialized empty Git repository in ./.git/
ssh: connect to host git.xyz.de port 22: Connection refused
fatal: The remote end hung up unexpectedly

EDIT2:
When sshing in normally, my ~/.ssh/config works:

$(13:12)-(80Kb)$ ssh git@git.xyz.de
PTY allocation request failed on channel 0
Welcome to GitLab, @root!
Connection to git.xyz.de closed.

Environment

  • PHP Censor version - 0.23.0
  • nginx version - 1.10.2
  • Operating System - CentOS 6.10
  • PHP version - 7.0.31
  • MySQL/PostgreSQL version - mysql 5.5.60

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions