the web, mobile technology and location based services as I see it
I’ve configured some deployment servers to use SSH over non-standard SSH ports and that can really be a problem when you want to use that with git. No matter what you do, git would always attempt to connect through the standard SSH port 22.
There was really no point in scratching my head and trying to pull my hair out in order to fix this. So I googled a solution. This post gave me a hint but wasn’t helpful enough so I decided to write a blog post on how to go about solving this.
You’ll have to configure your repository in your .ssh/config file. Here’s an example. Simply substitute the #*# placeholders for the actual values
Host #hostname# User #username# Hostname #hostname# Port #non-standard port#
And if you prefer to use private keys to login:
Host #hostname# User #username# Hostname #hostname# Port #non-standard port# PreferredAuthentications publickey IdentityFile "#path_to_private_key#"
Tim Akinbo's Weblog is the personal weblog of Tim Akinbo. Here he discusses issues relating to technology. Special interests include the web, mobile technology and location based services.
4 Responses to Using Git over non-standard SSH ports
Florian Vallen
October 9th, 2009 at 4:14 pm
Thank you so much. You safed my time
Josh Fraser
November 22nd, 2009 at 11:13 pm
Very helpful. Thanks for posting this.
Tim
November 23rd, 2009 at 3:17 pm
@josh and @florian, thanks for your comments and welcome to my blog.
exn
December 17th, 2009 at 12:24 pm
Maybe is another solutions ?
What you can suggest me if I have more than one repository via multiple logins and ports to the server ?