threads / discuss / 2732

Re: How can I specify a non-standard TCP port for a git+ssh connection?

Subject: Re: How can I specify a non-standard TCP port for a git+ssh connection?

## tl;dr

4 messages between Dec 2, 2005 and Dec 3, 2005.

replies: 3people: 3as markdown or json

linux@horizon.com· Dec 2, 2005, 19:31 UTC · lore

Actually, you don't need any git support. ssh allows you to set up "virtual hosts" with any combination of options you like.

Host <virtual>
        HostName <physical>
	Port <nonstandard>
        User <whoever>
        IdentityFile    <custom>
        ForwardAgent    no

So typing "ssh <virtual>" will have the effect of ssh <whoever>@<physical> -p <nonstandard> -i <custom> -a

Quite often, you let <virtual> == <physical>, so it's "custom settings for talking to this host", but you can have multiple different virtual names that all map to the same physical host.

But the point is that as long as you can pass a hostname through to ssh, you can carry as many custom settings as you like with it.

Andreas Jochens· Dec 3, 2005, 08:06 UTC · re: linux@horizon.com · lore
On 05-Dec-02 14:31, linux@horizon.com wrote:
> Actually, you don't need any git support.  ssh allows you to set up
> "virtual hosts" with any combination of options you like.
> So typing "ssh <virtual>" will have the effect of
> ssh <whoever>@<physical> -p <nonstandard> -i <custom> -a

This is a nice feature, of course. But I still have to edit a separate config file. In some cases (e.g. scripts using ad hoc port forwarding) it would be much easier if the non-standard port and maybe some other options could be specified directly on the git command line or in .git/branches.

Regards Andreas Jochens

Junio C Hamano· Dec 3, 2005, 19:09 UTC · re: Andreas Jochens · lore
Andreas Jochens <aj@andaco.de> writes:
> This is a nice feature, of course. But I still have to edit a separate 
> config file. In some cases (e.g. scripts using ad hoc port forwarding) it 
> would be much easier if the non-standard port and maybe some other
> options could be specified directly on the git command line or 

Having something on the command line to make it easy to override one-shot you might be able to talk me into, but not in a config file for git; there is a standard place to hold ssh configuration already.

Andreas Jochens· Dec 3, 2005, 21:43 UTC · re: Junio C Hamano · lore
On 05-Dec-03 11:09, Junio C Hamano wrote:
> Having something on the command line to make it easy to override
> one-shot you might be able to talk me into, but not in a config
> file for git; there is a standard place to hold ssh
> configuration already.

You are right, a duplication of ssh config file options in git config files should not be necessary.

A way to specify a non-standard port for ssh on the command line would be sufficient. It is possible to specify non-standard ports for the git, http and rsync protocols on the command line. Why not for ssh?

Regards Andreas Jochens

← back to recent threads