* how to pass ssh options to git?
@ 2006-11-02 9:07 Michael S. Tsirkin
2006-11-02 9:20 ` Matthieu Moy
0 siblings, 1 reply; 8+ messages in thread
From: Michael S. Tsirkin @ 2006-11-02 9:07 UTC (permalink / raw)
Cc: git
How is it possible to pass ssh options to git?
for example, I use these options to log into some machine:
ssh -i <private> -o HostKeyAlias=<alias> -p <port> -l <user> <address>
However, git will only let me specify the user name on command line as part of
the URL. I am guessing something can be done using core.gitProxy?
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: how to pass ssh options to git?
2006-11-02 9:07 how to pass ssh options to git? Michael S. Tsirkin
@ 2006-11-02 9:20 ` Matthieu Moy
2006-11-02 9:31 ` Michael S. Tsirkin
0 siblings, 1 reply; 8+ messages in thread
From: Matthieu Moy @ 2006-11-02 9:20 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: git
"Michael S. Tsirkin" <mst@mellanox.co.il> writes:
> How is it possible to pass ssh options to git?
> for example, I use these options to log into some machine:
> ssh -i <private> -o HostKeyAlias=<alias> -p <port> -l <user> <address>
Not answering the question, but this can go to ~/.ssh/config :
Host *.domain.net
User some_user
IdentityFile ~/.ssh/foobar
Host another.host
...
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: how to pass ssh options to git?
2006-11-02 9:20 ` Matthieu Moy
@ 2006-11-02 9:31 ` Michael S. Tsirkin
2006-11-02 11:06 ` Dennis Stosberg
2006-11-02 11:18 ` Nicolas Vilz 'niv'
0 siblings, 2 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2006-11-02 9:31 UTC (permalink / raw)
To: Matthieu Moy; +Cc: git
Quoting r. Matthieu Moy <Matthieu.Moy@imag.fr>:
> Subject: Re: how to pass ssh options to git?
>
> "Michael S. Tsirkin" <mst@mellanox.co.il> writes:
>
> > How is it possible to pass ssh options to git?
> > for example, I use these options to log into some machine:
> > ssh -i <private> -o HostKeyAlias=<alias> -p <port> -l <user> <address>
>
> Not answering the question, but this can go to ~/.ssh/config :
>
> Host *.domain.net
> User some_user
> IdentityFile ~/.ssh/foobar
>
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?
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: how to pass ssh options to git?
2006-11-02 9:31 ` Michael S. Tsirkin
@ 2006-11-02 11:06 ` Dennis Stosberg
2006-11-02 11:27 ` Michael S. Tsirkin
2006-11-02 11:18 ` Nicolas Vilz 'niv'
1 sibling, 1 reply; 8+ messages in thread
From: Dennis Stosberg @ 2006-11-02 11:06 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Matthieu Moy, 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.
Regards,
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: how to pass ssh options to git?
2006-11-02 9:31 ` Michael S. Tsirkin
2006-11-02 11:06 ` Dennis Stosberg
@ 2006-11-02 11:18 ` Nicolas Vilz 'niv'
1 sibling, 0 replies; 8+ messages in thread
From: Nicolas Vilz 'niv' @ 2006-11-02 11:18 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Matthieu Moy, git
Michael S. Tsirkin wrote:
> Quoting r. Matthieu Moy <Matthieu.Moy@imag.fr>:
>> Subject: Re: how to pass ssh options to git?
>>
>> "Michael S. Tsirkin" <mst@mellanox.co.il> writes:
>>
>>> How is it possible to pass ssh options to git?
>>> for example, I use these options to log into some machine:
>>> ssh -i <private> -o HostKeyAlias=<alias> -p <port> -l <user> <address>
>> Not answering the question, but this can go to ~/.ssh/config :
>>
>> Host *.domain.net
>> User some_user
>> IdentityFile ~/.ssh/foobar
>>
>
> 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 setup different host-entries as kind of virtual hosts in your
hosts-section. that is what i do
host blah1.domain.net
hostname www.domain.net
user blah1
IdentityFile .ssh/blah
Port 523434
host blah2.domain.net
hostname www.domain.net
user blah1
IdentityFile .ssh/blah
Port 22
The first host-section i use in an environment, where i cannot get
through port 22.
Sincerly
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: how to pass ssh options to git?
2006-11-02 11:06 ` Dennis Stosberg
@ 2006-11-02 11:27 ` Michael S. Tsirkin
2006-11-02 16:10 ` Linus Torvalds
0 siblings, 1 reply; 8+ messages in thread
From: Michael S. Tsirkin @ 2006-11-02 11:27 UTC (permalink / raw)
To: Dennis Stosberg; +Cc: Matthieu Moy, git
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.
BTW, just grep for GIT_SSH gets me some more:
GIT_SSH_UPLOAD, GIT_SSH_PUSH, GIT_SSH_PULL, GIT_SSH_FETCH.
None of which appear to be documented.
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: how to pass ssh options to git?
2006-11-02 11:27 ` Michael S. Tsirkin
@ 2006-11-02 16:10 ` Linus Torvalds
2006-11-02 20:22 ` Shawn Pearce
0 siblings, 1 reply; 8+ messages in thread
From: Linus Torvalds @ 2006-11-02 16:10 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Dennis Stosberg, Matthieu Moy, git
On Thu, 2 Nov 2006, Michael S. Tsirkin wrote:
> 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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: how to pass ssh options to git?
2006-11-02 16:10 ` Linus Torvalds
@ 2006-11-02 20:22 ` Shawn Pearce
0 siblings, 0 replies; 8+ messages in thread
From: Shawn Pearce @ 2006-11-02 20:22 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: git
Linus Torvalds <torvalds@osdl.org> wrote:
> 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
I often setup not only multiple fake hostnames in my .ssh/config
but I also setup multiple remote files under any given repository's
.git/remotes directory, using one file per fake hostname.
That way I can pick which options to apply at the time of git push
or git fetch by just changing the name passed to it.
$ ls .git/remotes
private public
$ cat .git/remotes/private
URL: private.host.com:/path/to/repo
Pull: refs/heads/master:refs/heads/origin
$ cat .git/remotes/public
URL: public.host.com:/path/to/repo
Pull: refs/heads/master:refs/heads/origin
$ git push private
$ git fetch public
I often need this to traverse around firewalls and whatnot.
It works pretty well, assuming I can remember where I'm currently
connected to. :-)
--
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-11-02 20:22 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-02 9:07 how to pass ssh options to git? Michael S. Tsirkin
2006-11-02 9:20 ` Matthieu Moy
2006-11-02 9:31 ` Michael S. Tsirkin
2006-11-02 11:06 ` Dennis Stosberg
2006-11-02 11:27 ` Michael S. Tsirkin
2006-11-02 16:10 ` Linus Torvalds
2006-11-02 20:22 ` Shawn Pearce
2006-11-02 11:18 ` Nicolas Vilz 'niv'
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox