Git On Custom SSH Port

ryanzec picture ryanzec · Apr 24, 2011 · Viewed 161.2k times · Source

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 the while I know I can give the port number when create a remote config, it seems like I can't do the same when doing a git clone. I am using gitolite so I 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 like

Host mydomain.com
    Port 12345

however in cygwin, that file does not seem to exist.

Answer

Christo picture Christo · Apr 24, 2011
git clone ssh://[email protected]:[port]/gitolite-admin

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