Hi. I have few different gitorious' accounts (for different workplaces and my personal), like git at gitorious.org:foo/foo.git git at gitorious.org:bar/bar.git I want to configure ssh to use different ssh keys for different repos. I try to do it with ~/.ssh/config. How I can match path? I want to get something like this: Match path foo/foo.git HostName gitorious.org User git IdentityFile ~/.ssh/foo.key Match path bar/bar.git HostName gitorious.org User git IdentityFile ~/.ssh/bar.key Thanks.
> On Dec 10, 2014, at 3:26 PM, chaser at cryptolab.net wrote: > > Hi. I have few different gitorious' accounts (for different workplaces and my personal), like > > git at gitorious.org:foo/foo.git > git at gitorious.org:bar/bar.git > > I want to configure ssh to use different ssh keys for different repos. I try to do it with ~/.ssh/config. > > How I can match path? I want to get something like this: > > Match path foo/foo.git > HostName gitorious.org > User git > IdentityFile ~/.ssh/foo.key > > Match path bar/bar.git > HostName gitorious.org > User git > IdentityFile ~/.ssh/bar.keyWhy not do: host gitwork HostName gitorious.org User git IdentityFile ~/.ssh/foo.key host githome HostName gitorious.org User git IdentityFile ~/.ssh/bar.key As "Match" is a server side feature not a client feature. And the above would mean you'd do: $ ssh gitwork:foo/foo.git or $ ssh githome:bar/bar.git I do this trick a lot when I have the same machine with multiple login (think one web server with multi-virtual hosts all with different chroot/sftp locations). - Ben
??????, 10-???-2014 16:53:14 Ben Lindstrom ????????:> Why not do: > > host gitwork > HostName gitorious.org > User git > IdentityFile ~/.ssh/foo.key > > > host githome > HostName gitorious.org > User git > IdentityFile ~/.ssh/bar.key > > > As "Match" is a server side feature not a client feature. And the above > would mean you'd do: > > $ ssh gitwork:foo/foo.git > or > $ ssh githome:bar/bar.git > > I do this trick a lot when I have the same machine with multiple login > (think one web server with multi-virtual hosts all with different > chroot/sftp locations). > > - BenThank you! That's what I need. BTW is it possible to make configuration without hostname modification?
Maybe Matching Threads
- URL path match in ssh config
- [LLVMdev] MC-JIT (any progress?)
- [Bug 3080] New: Document IdentityFile=none and clarify interaction of defaults with IdentitiesOnly
- augeas onlyif problem
- [Bug 1898] New: possible unreasonable behaviour when using ProxyCommand with multiple IdentityFile(s)