Search code examples
gitversion-controlsshcygwin

Git on custom SSH port


My VPS provider recommends that I leave my SSH port to the custom port number they assign it by default (not 22). The thing is, while I know I can provide the port number when creating a remote config, it seems I can't do the same when doing a Git clone. I am using gitolite so the clone commands look like:

git clone [email protected]:gitolite-admin

Is there a way to covert this to using the custom SSH port number?

I should also mention I am running Cygwin on Windows. I have seen multiple places saying to add the custom port to the ~/.ssh/config file:

Host mydomain.example
    Port 12345

However in Cygwin, that file does not seem to exist.


Solution

  • git clone ssh://[email protected]:[port]/gitolite-admin
    

    Note that the port number should be there without the square brackets: []