[prev in list] [next in list] [prev in thread] [next in thread]
List: git
Subject: Re: Use different ssh keys for different github repos (per-url sshCommand)
From: Sitaram Chamarty <sitaramc () gmail ! com>
Date: 2018-07-19 13:39:49
Message-ID: ff64d8b5-44f0-603e-fd87-5b8db86bd623 () gmail ! com
[Download RAW message or body]
On 07/19/2018 06:52 PM, Sitaram Chamarty wrote:
> On Thu, Jul 19, 2018 at 03:24:54PM +0300, Basin Ilya wrote:
> > Hi.
> >
> > I have two github accounts, one is for my organization and I want git to \
> > automatically choose the correct ssh `IdentityFile` based on the clone URL:
> > git@github.com:other/publicrepo.git
> > ~/.ssh/id_rsa
> > git@github.com:theorganization/privaterepo.git
> > ~/.ssh/id_rsa.theorganization
> >
> > Unfortunately, both URLs have same host name, therefore I can't configure this in \
> > the ssh client config. I could create a host alias there, but sometimes somebody \
> > else gives me the github URL and I want it to work out of the box.
> > I thought I could add a per-URL `core` section similar to `user` and `http`, but \
> > this section is ignored by git (2.18):
> > [core "git@github.com:theorganization"]
> > sshCommand = /bin/false
> > #sshCommand = ssh -i ~/.ssh/id_rsa.theorganization
> >
> > I thought of writing a wrapper script to deduce the key from the arguments:
> >
> > git@github.com git-upload-pack '/theorganization/privaterepo.git'
> >
> > Is this the only option?
>
> This is what I do (I don't have two accounts on github, but
> elsewhere; same idea though)
my apologies; I did not read your email fully and went off half-cocked!
Looks like you already tried host aliases and they don't work for you.
Sorry for the noise!
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic