How to use Git over a custom SSH port

This will be a quick tip! If you are using Git over SSH and the Git server isn’t using the default port of 22 for SSH things doesn’t just work any more. You can no longer for instance run:

git clone git@gitlab.domain.net:group/project.git

That will just time out since Git assumes you are using the default port. Instead you need to run the following command:

git clone ssh://git@gitlab.domain.net:5555/group/project.git

Replace 5555 with the custom port that your Git server is using.