git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: how to pass ssh options to git?

From
Linus Torvalds <torvalds@osdl.org>
Date
Nov 2, 2006, 16:10 UTC
Message-ID
<Pine.LNX.4.64.0611020801160.25218@g5.osdl.org>
In-Reply-To
<20061102112720.GA8469@mellanox.co.il>
On Thu, 2 Nov 2006, Michael S. Tsirkin wrote:
Show 17 quoted lines
> Quoting r. Dennis Stosberg <dennis@stosberg.net>:
> > Subject: Re: how to pass ssh options to git?
> > 
> > Michael S. Tsirkin wrote:
> > 
> > > I know, problem is I want to use different options at different times.
> > > I could use -F configfile ssh option, but how to pass *that* to git?
> >  
> > You can set the path of the ssh executable to use with the GIT_SSH
> > environment variable.  Create a shell script like
> > 
> > #!/bin/sh
> > exec ssh --your-options-- $*
> > 
> > and make GIT_SSH point to it.
> 
> Thanks, I'll try that.
It's really better to use a ".ssh/config" file instead.

I realize that you want to use different options "dynamically", but what you can do is to just have different "fake hostnames". For example, you can do

	Host private.host.com
		User myname
		Hostname host.com
		IdentityFile /home/myname/.ssh/private-identity
	Host public.host.com
		User groupname
		Hostname host.com
		IdentityFile /home/myname/.ssh/public-identity

and now you can ssh to "host.com" using different identities by just using "private.host.com" and "public.host.com" respectively. You can do pretty much any options that way.

Very convenient, if you have just a couple of "standard" setups.

Obviously we _could_ just add support for arbitrary ssh options, but it gets pretty ugly pretty quickly, so I'd suggest trying to use the .ssh/config approach with different hostnames if that is at all possible.

Previous: Michael S. TsirkinNext: Shawn Pearce
Message 6 of 8 in “how to pass ssh options to git?”
  1. Michael S. TsirkinNov 2, 2006
  2. Matthieu MoyNov 2, 2006
  3. Michael S. TsirkinNov 2, 2006
  4. Dennis StosbergNov 2, 2006
  5. Michael S. TsirkinNov 2, 2006
  6. Linus TorvaldsNov 2, 2006
  7. Shawn PearceNov 2, 2006
  8. Nicolas Vilz 'niv'Nov 2, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.