{"thread":{"id":"43078","subject":"Re: how to pass ssh options to git?","startedAt":"2006-11-02T09:07:17Z","lastAt":"2006-11-02T20:22:30Z","messageCount":8,"participants":["Michael S. Tsirkin","Dennis Stosberg","Shawn Pearce","Linus Torvalds","Matthieu Moy","Nicolas Vilz 'niv'"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"298346","messageId":"20061102090717.GE7468@mellanox.co.il","threadId":"43078","inReplyTo":null,"subject":"how to pass ssh options to git?","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-11-02T09:07:17Z","receivedAt":"2006-11-02T09:07:17Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"How is it possible to pass ssh options to git?\nfor example, I use these options to log into some machine:\nssh -i <private> -o HostKeyAlias=<alias> -p <port> -l <user> <address>\n\nHowever, git will only let me specify the user name on command line as part of\nthe URL.  I am guessing something can be done using core.gitProxy?\n\n\n\n-- \n"},{"id":"297415","messageId":"vpqejsm433c.fsf@ecrins.imag.fr","threadId":"43078","inReplyTo":"20061102090717.GE7468@mellanox.co.il","subject":"Re: how to pass ssh options to git?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2006-11-02T09:20:23Z","receivedAt":"2006-11-02T09:20:23Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n\n> How is it possible to pass ssh options to git?\n> for example, I use these options to log into some machine:\n> ssh -i <private> -o HostKeyAlias=<alias> -p <port> -l <user> <address>\n\nNot answering the question, but this can go to ~/.ssh/config :\n\nHost *.domain.net\nUser some_user\nIdentityFile ~/.ssh/foobar\n\nHost another.host\n...\n\n-- \n"},{"id":"297980","messageId":"20061102093153.GF7468@mellanox.co.il","threadId":"43078","inReplyTo":"vpqejsm433c.fsf@ecrins.imag.fr","subject":"Re: how to pass ssh options to git?","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-11-02T09:31:53Z","receivedAt":"2006-11-02T09:31:53Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Quoting r. Matthieu Moy <Matthieu.Moy@imag.fr>:\n> Subject: Re: how to pass ssh options to git?\n> \n> \"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n> \n> > How is it possible to pass ssh options to git?\n> > for example, I use these options to log into some machine:\n> > ssh -i <private> -o HostKeyAlias=<alias> -p <port> -l <user> <address>\n> \n> Not answering the question, but this can go to ~/.ssh/config :\n> \n> Host *.domain.net\n> User some_user\n> IdentityFile ~/.ssh/foobar\n> \n\nI know, problem is I want to use different options at different times.\nI could use -F configfile ssh option, but how to pass *that* to git?\n\n-- \n"},{"id":"294490","messageId":"20061102110639.G523a966f@leonov.stosberg.net","threadId":"43078","inReplyTo":"20061102093153.GF7468@mellanox.co.il","subject":"Re: how to pass ssh options to git?","fromName":"Dennis Stosberg","fromEmail":"dennis@stosberg.net","sentAt":"2006-11-02T11:06:39Z","receivedAt":"2006-11-02T11:06:39Z","isPatch":false,"sender":{"key":"dennis@stosberg.net","avatar":null},"body":"Michael S. Tsirkin wrote:\n\n> I know, problem is I want to use different options at different times.\n> I could use -F configfile ssh option, but how to pass *that* to git?\n \nYou can set the path of the ssh executable to use with the GIT_SSH\nenvironment variable.  Create a shell script like\n\n#!/bin/sh\nexec ssh --your-options-- $*\n\nand make GIT_SSH point to it.\n\nRegards,\n"},{"id":"297742","messageId":"4549D418.3050606@iaglans.de","threadId":"43078","inReplyTo":"20061102093153.GF7468@mellanox.co.il","subject":"Re: how to pass ssh options to git?","fromName":"Nicolas Vilz 'niv'","fromEmail":"niv@iaglans.de","sentAt":"2006-11-02T11:18:48Z","receivedAt":"2006-11-02T11:18:48Z","isPatch":false,"sender":{"key":"niv@iaglans.de","avatar":"https://gravatar.com/avatar/e4d43a32d721241212d4edb1d2210327e28423c913071b4bfeeaa0ce15296110?d=mp&s=160"},"body":"Michael S. Tsirkin wrote:\n> Quoting r. Matthieu Moy <Matthieu.Moy@imag.fr>:\n>> Subject: Re: how to pass ssh options to git?\n>>\n>> \"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n>>\n>>> How is it possible to pass ssh options to git?\n>>> for example, I use these options to log into some machine:\n>>> ssh -i <private> -o HostKeyAlias=<alias> -p <port> -l <user> <address>\n>> Not answering the question, but this can go to ~/.ssh/config :\n>>\n>> Host *.domain.net\n>> User some_user\n>> IdentityFile ~/.ssh/foobar\n>>\n> \n> I know, problem is I want to use different options at different times.\n> I could use -F configfile ssh option, but how to pass *that* to git?\n\nyou can setup different host-entries as kind of virtual hosts in your \nhosts-section. that is what i do\n\nhost blah1.domain.net\nhostname www.domain.net\nuser blah1\nIdentityFile .ssh/blah\nPort 523434\n\nhost blah2.domain.net\nhostname www.domain.net\nuser blah1\nIdentityFile .ssh/blah\nPort 22\n\nThe first host-section i use in an environment, where i cannot get \nthrough port 22.\n\n\nSincerly\n"},{"id":"293817","messageId":"20061102112720.GA8469@mellanox.co.il","threadId":"43078","inReplyTo":"20061102110639.G523a966f@leonov.stosberg.net","subject":"Re: how to pass ssh options to git?","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-11-02T11:27:20Z","receivedAt":"2006-11-02T11:27:20Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Quoting r. Dennis Stosberg <dennis@stosberg.net>:\n> Subject: Re: how to pass ssh options to git?\n> \n> Michael S. Tsirkin wrote:\n> \n> > I know, problem is I want to use different options at different times.\n> > I could use -F configfile ssh option, but how to pass *that* to git?\n>  \n> You can set the path of the ssh executable to use with the GIT_SSH\n> environment variable.  Create a shell script like\n> \n> #!/bin/sh\n> exec ssh --your-options-- $*\n> \n> and make GIT_SSH point to it.\n\nThanks, I'll try that.\nBTW, just grep for GIT_SSH gets me some more:\nGIT_SSH_UPLOAD, GIT_SSH_PUSH, GIT_SSH_PULL, GIT_SSH_FETCH.\nNone of which appear to be documented.\n\n\n\n\n\n-- \n"},{"id":"296669","messageId":"Pine.LNX.4.64.0611020801160.25218@g5.osdl.org","threadId":"43078","inReplyTo":"20061102112720.GA8469@mellanox.co.il","subject":"Re: how to pass ssh options to git?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-11-02T16:10:12Z","receivedAt":"2006-11-02T16:10:12Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 2 Nov 2006, Michael S. Tsirkin wrote:\n\n> Quoting r. Dennis Stosberg <dennis@stosberg.net>:\n> > Subject: Re: how to pass ssh options to git?\n> > \n> > Michael S. Tsirkin wrote:\n> > \n> > > I know, problem is I want to use different options at different times.\n> > > I could use -F configfile ssh option, but how to pass *that* to git?\n> >  \n> > You can set the path of the ssh executable to use with the GIT_SSH\n> > environment variable.  Create a shell script like\n> > \n> > #!/bin/sh\n> > exec ssh --your-options-- $*\n> > \n> > and make GIT_SSH point to it.\n> \n> Thanks, I'll try that.\n\nIt's really better to use a \".ssh/config\" file instead.\n\nI realize that you want to use different options \"dynamically\", but what \nyou can do is to just have different \"fake hostnames\". For example, you \ncan do\n\n\tHost private.host.com\n\t\tUser myname\n\t\tHostname host.com\n\t\tIdentityFile /home/myname/.ssh/private-identity\n\tHost public.host.com\n\t\tUser groupname\n\t\tHostname host.com\n\t\tIdentityFile /home/myname/.ssh/public-identity\n\nand now you can ssh to \"host.com\" using different identities by just using \n\"private.host.com\" and \"public.host.com\" respectively. You can do pretty \nmuch any options that way.\n\nVery convenient, if you have just a couple of \"standard\" setups.\n\nObviously we _could_ just add support for arbitrary ssh options, but it \ngets pretty ugly pretty quickly, so I'd suggest trying to use the \n.ssh/config approach with different hostnames if that is at all possible.\n\n"},{"id":"295047","messageId":"20061102202230.GA21456@spearce.org","threadId":"43078","inReplyTo":"Pine.LNX.4.64.0611020801160.25218@g5.osdl.org","subject":"Re: how to pass ssh options to git?","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-11-02T20:22:30Z","receivedAt":"2006-11-02T20:22:30Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> wrote:\n> It's really better to use a \".ssh/config\" file instead.\n> \n> I realize that you want to use different options \"dynamically\", but what \n> you can do is to just have different \"fake hostnames\". For example, you \n> can do\n> \n> \tHost private.host.com\n> \t\tUser myname\n> \t\tHostname host.com\n> \t\tIdentityFile /home/myname/.ssh/private-identity\n> \tHost public.host.com\n> \t\tUser groupname\n> \t\tHostname host.com\n> \t\tIdentityFile /home/myname/.ssh/public-identity\n\nI often setup not only multiple fake hostnames in my .ssh/config\nbut I also setup multiple remote files under any given repository's\n.git/remotes directory, using one file per fake hostname.\n\nThat way I can pick which options to apply at the time of git push\nor git fetch by just changing the name passed to it.\n\n\t$ ls .git/remotes\n\tprivate public\n\n\t$ cat .git/remotes/private\n\tURL: private.host.com:/path/to/repo\n\tPull: refs/heads/master:refs/heads/origin\n\n\t$ cat .git/remotes/public\n\tURL: public.host.com:/path/to/repo\n\tPull: refs/heads/master:refs/heads/origin\n\n\t$ git push private\n\t$ git fetch public\n\nI often need this to traverse around firewalls and whatnot.\nIt works pretty well, assuming I can remember where I'm currently\nconnected to.  :-)\n\n-- \n"}]}