threads / discuss / 47587

Re: How to use multiple SSH keys on Git exe (not bash)

Subject: Re: How to use multiple SSH keys on Git exe (not bash)

## tl;dr

10 messages between Jan 10, 2018 and Jan 10, 2018.

replies: 9people: 3as markdown or json

Sam Millman· Jan 10, 2018, 15:30 UTC · lore

I am trying, for the sake of PhpStorm, to get multiple SSH keys working using git . exe, which means no GitBash.

I can get the keys to work just fine with GitBash.
I edited my .ssh/config to look like (I know this is incorrect):

Host bitucket . org IdentityFile ~/.ssh/id_rsa1

Host bitbucket . org IdentityFile ~/.ssh/id_rsa

And id_rsa1 works, I can actually pick from the other repo. But, of course, id_rsa does not now.

I change to:

Host bitucket . org-dd HostName bitbucket . org IdentityFile ~/.ssh/id_rsa1

Host bitbucket . org-sas HostName bitbucket . org IdentityFile ~/.ssh/id_rsa

And now only id_rsa works.

I also tried combining the two IdentityFile lines together like so (for some reason):

Host bitucket . org IdentityFile ~/.ssh/id_rsa1 IdentityFile ~/.ssh/id_rsa

I have even tried running ssh-agent . exe, adding id_rsa1 to that and then running the git clone with no result.

The weird thing is, I have two public keys as well and they both load in the ssh . exe (they return errors about format), I just cannot get my ssh . exe to work with multiple private keys.

On 10 January 2018 at 15:29, Sam Millman <sam.millman@gmail.com> wrote:
Show 44 quoted lines
> I am trying, for the sake of PhpStorm, to get multiple SSH keys working
> using git . exe, which means no GitBash.
>
> I can get the keys to work just fine with GitBash.
>
> I edited my .ssh/config to look like (I know this is incorrect):
>
> Host bitucket . org
> IdentityFile ~/.ssh/id_rsa1
>
> Host bitbucket . org
> IdentityFile ~/.ssh/id_rsa
>
>
> And id_rsa1 works, I can actually pick from the other repo. But, of course,
> id_rsa does not now.
>
> I change to:
>
> Host bitucket . org-dd
> HostName bitbucket . org
> IdentityFile ~/.ssh/id_rsa1
>
> Host bitbucket . org-sas
> HostName bitbucket . org
> IdentityFile ~/.ssh/id_rsa
>
> And now only id_rsa works.
>
> I also tried combining the two IdentityFile lines together like so (for some
> reason):
>
> Host bitucket . org
> IdentityFile ~/.ssh/id_rsa1
> IdentityFile ~/.ssh/id_rsa
>
> I have even tried running ssh-agent . exe, adding id_rsa1 to that and then
> running the git clone with no result.
>
> The weird thing is, I have two public keys as well and they both load in the
> ssh . exe (they return errors about format), I just cannot get my ssh . exe
> to work with multiple private keys.
>
> Has anyone got any ideas on how to solve this?
Randall S. Becker· Jan 10, 2018, 15:58 UTC · re: Sam Millman · lore

RE: How to use multiple SSH keys on Git exe (not bash)

On January 10, 2018 10:31 AM Sam Millman wrote:
Show 89 quoted lines
> I am trying, for the sake of PhpStorm, to get multiple SSH keys working using
> git . exe, which means no GitBash.
> 
> I can get the keys to work just fine with GitBash.
> 
> I edited my .ssh/config to look like (I know this is incorrect):
> 
> Host bitucket . org
> IdentityFile ~/.ssh/id_rsa1
> 
> Host bitbucket . org
> IdentityFile ~/.ssh/id_rsa
> 
> 
> And id_rsa1 works, I can actually pick from the other repo. But, of course,
> id_rsa does not now.
> 
> I change to:
> 
> Host bitucket . org-dd
> HostName bitbucket . org
> IdentityFile ~/.ssh/id_rsa1
> 
> Host bitbucket . org-sas
> HostName bitbucket . org
> IdentityFile ~/.ssh/id_rsa
> 
> And now only id_rsa works.
> 
> I also tried combining the two IdentityFile lines together like so (for some
> reason):
> 
> Host bitucket . org
> IdentityFile ~/.ssh/id_rsa1
> IdentityFile ~/.ssh/id_rsa
> 
> I have even tried running ssh-agent . exe, adding id_rsa1 to that and then
> running the git clone with no result.
> 
> The weird thing is, I have two public keys as well and they both load in the
> ssh . exe (they return errors about format), I just cannot get my ssh . exe to
> work with multiple private keys.
> 
> On 10 January 2018 at 15:29, Sam Millman <sam.millman@gmail.com> wrote:
> > I am trying, for the sake of PhpStorm, to get multiple SSH keys
> > working using git . exe, which means no GitBash.
> >
> > I can get the keys to work just fine with GitBash.
> >
> > I edited my .ssh/config to look like (I know this is incorrect):
> >
> > Host bitucket . org
> > IdentityFile ~/.ssh/id_rsa1
> >
> > Host bitbucket . org
> > IdentityFile ~/.ssh/id_rsa
> >
> >
> > And id_rsa1 works, I can actually pick from the other repo. But, of
> > course, id_rsa does not now.
> >
> > I change to:
> >
> > Host bitucket . org-dd
> > HostName bitbucket . org
> > IdentityFile ~/.ssh/id_rsa1
> >
> > Host bitbucket . org-sas
> > HostName bitbucket . org
> > IdentityFile ~/.ssh/id_rsa
> >
> > And now only id_rsa works.
> >
> > I also tried combining the two IdentityFile lines together like so
> > (for some
> > reason):
> >
> > Host bitucket . org
> > IdentityFile ~/.ssh/id_rsa1
> > IdentityFile ~/.ssh/id_rsa
> >
> > I have even tried running ssh-agent . exe, adding id_rsa1 to that and
> > then running the git clone with no result.
> >
> > The weird thing is, I have two public keys as well and they both load
> > in the ssh . exe (they return errors about format), I just cannot get
> > my ssh . exe to work with multiple private keys.
> >
> > Has anyone got any ideas on how to solve this?
The ~/.ssh/config file is case sensitive by definition when it comes to Host and HostName. Try bitbucket.org for one and Bitbucket.org for another. You will have to change the remote URL accordingly to pick up the correct identity.

Good luck, Randall

Sam Millman· Jan 10, 2018, 16:01 UTC · re: Randall S. Becker · lore

That would mean I would need to change the case for a letter everytime I have a repo with a new key, that would mean I would be restricted to 12 client repos at a time :\, seems very hacky to me

On 10 January 2018 at 15:58, Randall S. Becker <rsbecker@nexbridge.com> wrote:
Show 97 quoted lines
> On January 10, 2018 10:31 AM Sam Millman wrote:
>> I am trying, for the sake of PhpStorm, to get multiple SSH keys working using
>> git . exe, which means no GitBash.
>>
>> I can get the keys to work just fine with GitBash.
>>
>> I edited my .ssh/config to look like (I know this is incorrect):
>>
>> Host bitucket . org
>> IdentityFile ~/.ssh/id_rsa1
>>
>> Host bitbucket . org
>> IdentityFile ~/.ssh/id_rsa
>>
>>
>> And id_rsa1 works, I can actually pick from the other repo. But, of course,
>> id_rsa does not now.
>>
>> I change to:
>>
>> Host bitucket . org-dd
>> HostName bitbucket . org
>> IdentityFile ~/.ssh/id_rsa1
>>
>> Host bitbucket . org-sas
>> HostName bitbucket . org
>> IdentityFile ~/.ssh/id_rsa
>>
>> And now only id_rsa works.
>>
>> I also tried combining the two IdentityFile lines together like so (for some
>> reason):
>>
>> Host bitucket . org
>> IdentityFile ~/.ssh/id_rsa1
>> IdentityFile ~/.ssh/id_rsa
>>
>> I have even tried running ssh-agent . exe, adding id_rsa1 to that and then
>> running the git clone with no result.
>>
>> The weird thing is, I have two public keys as well and they both load in the
>> ssh . exe (they return errors about format), I just cannot get my ssh . exe to
>> work with multiple private keys.
>>
>> On 10 January 2018 at 15:29, Sam Millman <sam.millman@gmail.com> wrote:
>> > I am trying, for the sake of PhpStorm, to get multiple SSH keys
>> > working using git . exe, which means no GitBash.
>> >
>> > I can get the keys to work just fine with GitBash.
>> >
>> > I edited my .ssh/config to look like (I know this is incorrect):
>> >
>> > Host bitucket . org
>> > IdentityFile ~/.ssh/id_rsa1
>> >
>> > Host bitbucket . org
>> > IdentityFile ~/.ssh/id_rsa
>> >
>> >
>> > And id_rsa1 works, I can actually pick from the other repo. But, of
>> > course, id_rsa does not now.
>> >
>> > I change to:
>> >
>> > Host bitucket . org-dd
>> > HostName bitbucket . org
>> > IdentityFile ~/.ssh/id_rsa1
>> >
>> > Host bitbucket . org-sas
>> > HostName bitbucket . org
>> > IdentityFile ~/.ssh/id_rsa
>> >
>> > And now only id_rsa works.
>> >
>> > I also tried combining the two IdentityFile lines together like so
>> > (for some
>> > reason):
>> >
>> > Host bitucket . org
>> > IdentityFile ~/.ssh/id_rsa1
>> > IdentityFile ~/.ssh/id_rsa
>> >
>> > I have even tried running ssh-agent . exe, adding id_rsa1 to that and
>> > then running the git clone with no result.
>> >
>> > The weird thing is, I have two public keys as well and they both load
>> > in the ssh . exe (they return errors about format), I just cannot get
>> > my ssh . exe to work with multiple private keys.
>> >
>> > Has anyone got any ideas on how to solve this?
>
> The ~/.ssh/config file is case sensitive by definition when it comes to Host and HostName. Try bitbucket.org for one and Bitbucket.org for another. You will have to change the remote URL accordingly to pick up the correct identity.
>
> Good luck,
> Randall
>
>
Randall S. Becker· Jan 10, 2018, 16:14 UTC · re: Sam Millman · lore

RE: How to use multiple SSH keys on Git exe (not bash)

On January 10, 2018 11:01 AM Sam Millman wrote:
Show 10 quoted lines
> That would mean I would need to change the case for a letter everytime I
> have a repo with a new key, that would mean I would be restricted to
> 12 client repos at a time :\, seems very hacky to me
> 
> On 10 January 2018 at 15:58, Randall S. Becker <rsbecker@nexbridge.com>
> wrote:
> > The ~/.ssh/config file is case sensitive by definition when it comes to Host
> and HostName. Try bitbucket.org for one and Bitbucket.org for another. You
> will have to change the remote URL accordingly to pick up the correct
> identity.
The combinatorics of it is Sum i=1 to n.(i) = 78.
You can also use BUtbucket.org, bUTbucket.org, etc., BUTbucket.org, etc., etc.
Hacky, maybe, but it has worked that way for a long time. Why do you need more than 78 identities? Bitbucket allows you to be on multiple projects with the same identity.
Ævar Arnfjörð Bjarmason· Jan 10, 2018, 15:58 UTC · re: Sam Millman · lore
On Wed, Jan 10 2018, Sam Millman jotted:
Show 42 quoted lines
> I am trying, for the sake of PhpStorm, to get multiple SSH keys
> working using git . exe, which means no GitBash.
>
> I can get the keys to work just fine with GitBash.
>
> I edited my .ssh/config to look like (I know this is incorrect):
>
> Host bitucket . org
> IdentityFile ~/.ssh/id_rsa1
>
> Host bitbucket . org
> IdentityFile ~/.ssh/id_rsa
>
>
> And id_rsa1 works, I can actually pick from the other repo. But, of
> course, id_rsa does not now.
>
> I change to:
>
> Host bitucket . org-dd
> HostName bitbucket . org
> IdentityFile ~/.ssh/id_rsa1
>
> Host bitbucket . org-sas
> HostName bitbucket . org
> IdentityFile ~/.ssh/id_rsa
>
> And now only id_rsa works.
>
> I also tried combining the two IdentityFile lines together like so
> (for some reason):
>
> Host bitucket . org
> IdentityFile ~/.ssh/id_rsa1
> IdentityFile ~/.ssh/id_rsa
>
> I have even tried running ssh-agent . exe, adding id_rsa1 to that and
> then running the git clone with no result.
>
> The weird thing is, I have two public keys as well and they both load
> in the ssh . exe (they return errors about format), I just cannot get
> my ssh . exe to work with multiple private keys.

This might just be a special case of the problem of some hosting providers picking only the first key you provide, as described in this thread: https://public-inbox.org/git/20180103102840.27897-1-avarab@gmail.com/

If so, you either need to hack around this with ssh host aliases, or a custom GIT_SSH_COMMAND.

Show 45 quoted lines
> On 10 January 2018 at 15:29, Sam Millman <sam.millman@gmail.com> wrote:
>> I am trying, for the sake of PhpStorm, to get multiple SSH keys working
>> using git . exe, which means no GitBash.
>>
>> I can get the keys to work just fine with GitBash.
>>
>> I edited my .ssh/config to look like (I know this is incorrect):
>>
>> Host bitucket . org
>> IdentityFile ~/.ssh/id_rsa1
>>
>> Host bitbucket . org
>> IdentityFile ~/.ssh/id_rsa
>>
>>
>> And id_rsa1 works, I can actually pick from the other repo. But, of course,
>> id_rsa does not now.
>>
>> I change to:
>>
>> Host bitucket . org-dd
>> HostName bitbucket . org
>> IdentityFile ~/.ssh/id_rsa1
>>
>> Host bitbucket . org-sas
>> HostName bitbucket . org
>> IdentityFile ~/.ssh/id_rsa
>>
>> And now only id_rsa works.
>>
>> I also tried combining the two IdentityFile lines together like so (for some
>> reason):
>>
>> Host bitucket . org
>> IdentityFile ~/.ssh/id_rsa1
>> IdentityFile ~/.ssh/id_rsa
>>
>> I have even tried running ssh-agent . exe, adding id_rsa1 to that and then
>> running the git clone with no result.
>>
>> The weird thing is, I have two public keys as well and they both load in the
>> ssh . exe (they return errors about format), I just cannot get my ssh . exe
>> to work with multiple private keys.
>>
>> Has anyone got any ideas on how to solve this?
Sam Millman· Jan 10, 2018, 16:02 UTC · re: Ævar Arnfjörð Bjarmason · lore
I actually played a bit more and got this:

Host * IdentityFile ~/.ssh/id_rsa_d IdentityFile ~/.ssh/id_rsa

Host bitbucket_1 User git HostName bitbucket.org IdentityFile ~/.ssh/id_rsa_d

Host bitbucket_2 User git HostName bitbucket.org IdentityFile ~/.ssh/id_rsa

And from basic testing it seems to actually work, it seems it is the Host * that make sit work and it will actually iterate the keys and try them.

Not sure why this is, any thoughts?
On 10 January 2018 at 15:58, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
Show 99 quoted lines
>
> On Wed, Jan 10 2018, Sam Millman jotted:
>
>> I am trying, for the sake of PhpStorm, to get multiple SSH keys
>> working using git . exe, which means no GitBash.
>>
>> I can get the keys to work just fine with GitBash.
>>
>> I edited my .ssh/config to look like (I know this is incorrect):
>>
>> Host bitucket . org
>> IdentityFile ~/.ssh/id_rsa1
>>
>> Host bitbucket . org
>> IdentityFile ~/.ssh/id_rsa
>>
>>
>> And id_rsa1 works, I can actually pick from the other repo. But, of
>> course, id_rsa does not now.
>>
>> I change to:
>>
>> Host bitucket . org-dd
>> HostName bitbucket . org
>> IdentityFile ~/.ssh/id_rsa1
>>
>> Host bitbucket . org-sas
>> HostName bitbucket . org
>> IdentityFile ~/.ssh/id_rsa
>>
>> And now only id_rsa works.
>>
>> I also tried combining the two IdentityFile lines together like so
>> (for some reason):
>>
>> Host bitucket . org
>> IdentityFile ~/.ssh/id_rsa1
>> IdentityFile ~/.ssh/id_rsa
>>
>> I have even tried running ssh-agent . exe, adding id_rsa1 to that and
>> then running the git clone with no result.
>>
>> The weird thing is, I have two public keys as well and they both load
>> in the ssh . exe (they return errors about format), I just cannot get
>> my ssh . exe to work with multiple private keys.
>
> This might just be a special case of the problem of some hosting
> providers picking only the first key you provide, as described in this
> thread:
> https://public-inbox.org/git/20180103102840.27897-1-avarab@gmail.com/
>
> If so, you either need to hack around this with ssh host aliases, or a
> custom GIT_SSH_COMMAND.
>
>> On 10 January 2018 at 15:29, Sam Millman <sam.millman@gmail.com> wrote:
>>> I am trying, for the sake of PhpStorm, to get multiple SSH keys working
>>> using git . exe, which means no GitBash.
>>>
>>> I can get the keys to work just fine with GitBash.
>>>
>>> I edited my .ssh/config to look like (I know this is incorrect):
>>>
>>> Host bitucket . org
>>> IdentityFile ~/.ssh/id_rsa1
>>>
>>> Host bitbucket . org
>>> IdentityFile ~/.ssh/id_rsa
>>>
>>>
>>> And id_rsa1 works, I can actually pick from the other repo. But, of course,
>>> id_rsa does not now.
>>>
>>> I change to:
>>>
>>> Host bitucket . org-dd
>>> HostName bitbucket . org
>>> IdentityFile ~/.ssh/id_rsa1
>>>
>>> Host bitbucket . org-sas
>>> HostName bitbucket . org
>>> IdentityFile ~/.ssh/id_rsa
>>>
>>> And now only id_rsa works.
>>>
>>> I also tried combining the two IdentityFile lines together like so (for some
>>> reason):
>>>
>>> Host bitucket . org
>>> IdentityFile ~/.ssh/id_rsa1
>>> IdentityFile ~/.ssh/id_rsa
>>>
>>> I have even tried running ssh-agent . exe, adding id_rsa1 to that and then
>>> running the git clone with no result.
>>>
>>> The weird thing is, I have two public keys as well and they both load in the
>>> ssh . exe (they return errors about format), I just cannot get my ssh . exe
>>> to work with multiple private keys.
>>>
>>> Has anyone got any ideas on how to solve this?
Randall S. Becker· Jan 10, 2018, 16:23 UTC · re: Sam Millman · lore

RE: How to use multiple SSH keys on Git exe (not bash)

May I, with respect, ask you to take this to the OpenSSH email list? (openssh-unix-dev@mindrot.org) I think the discussion better belongs there and you're likely to get more detailed information from that team. Sincerely, Randall

Show 132 quoted lines
> -----Original Message-----
> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On
> Behalf Of Sam Millman
> Sent: January 10, 2018 11:03 AM
> To: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> Cc: git@vger.kernel.org
> Subject: Re: How to use multiple SSH keys on Git exe (not bash)
> 
> I actually played a bit more and got this:
> 
> Host *
> IdentityFile ~/.ssh/id_rsa_d
> IdentityFile ~/.ssh/id_rsa
> 
> Host bitbucket_1
> User git
> HostName bitbucket.org
> IdentityFile ~/.ssh/id_rsa_d
> 
> Host bitbucket_2
> User git
> HostName bitbucket.org
> IdentityFile ~/.ssh/id_rsa
> 
> And from basic testing it seems to actually work, it seems it is the Host * that
> make sit work and it will actually iterate the keys and try them.
> 
> Not sure why this is, any thoughts?
> 
> On 10 January 2018 at 15:58, Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> wrote:
> >
> > On Wed, Jan 10 2018, Sam Millman jotted:
> >
> >> I am trying, for the sake of PhpStorm, to get multiple SSH keys
> >> working using git . exe, which means no GitBash.
> >>
> >> I can get the keys to work just fine with GitBash.
> >>
> >> I edited my .ssh/config to look like (I know this is incorrect):
> >>
> >> Host bitucket . org
> >> IdentityFile ~/.ssh/id_rsa1
> >>
> >> Host bitbucket . org
> >> IdentityFile ~/.ssh/id_rsa
> >>
> >>
> >> And id_rsa1 works, I can actually pick from the other repo. But, of
> >> course, id_rsa does not now.
> >>
> >> I change to:
> >>
> >> Host bitucket . org-dd
> >> HostName bitbucket . org
> >> IdentityFile ~/.ssh/id_rsa1
> >>
> >> Host bitbucket . org-sas
> >> HostName bitbucket . org
> >> IdentityFile ~/.ssh/id_rsa
> >>
> >> And now only id_rsa works.
> >>
> >> I also tried combining the two IdentityFile lines together like so
> >> (for some reason):
> >>
> >> Host bitucket . org
> >> IdentityFile ~/.ssh/id_rsa1
> >> IdentityFile ~/.ssh/id_rsa
> >>
> >> I have even tried running ssh-agent . exe, adding id_rsa1 to that and
> >> then running the git clone with no result.
> >>
> >> The weird thing is, I have two public keys as well and they both load
> >> in the ssh . exe (they return errors about format), I just cannot get
> >> my ssh . exe to work with multiple private keys.
> >
> > This might just be a special case of the problem of some hosting
> > providers picking only the first key you provide, as described in this
> > thread:
> > https://public-inbox.org/git/20180103102840.27897-1-avarab@gmail.com/
> >
> > If so, you either need to hack around this with ssh host aliases, or a
> > custom GIT_SSH_COMMAND.
> >
> >> On 10 January 2018 at 15:29, Sam Millman <sam.millman@gmail.com>
> wrote:
> >>> I am trying, for the sake of PhpStorm, to get multiple SSH keys
> >>> working using git . exe, which means no GitBash.
> >>>
> >>> I can get the keys to work just fine with GitBash.
> >>>
> >>> I edited my .ssh/config to look like (I know this is incorrect):
> >>>
> >>> Host bitucket . org
> >>> IdentityFile ~/.ssh/id_rsa1
> >>>
> >>> Host bitbucket . org
> >>> IdentityFile ~/.ssh/id_rsa
> >>>
> >>>
> >>> And id_rsa1 works, I can actually pick from the other repo. But, of
> >>> course, id_rsa does not now.
> >>>
> >>> I change to:
> >>>
> >>> Host bitucket . org-dd
> >>> HostName bitbucket . org
> >>> IdentityFile ~/.ssh/id_rsa1
> >>>
> >>> Host bitbucket . org-sas
> >>> HostName bitbucket . org
> >>> IdentityFile ~/.ssh/id_rsa
> >>>
> >>> And now only id_rsa works.
> >>>
> >>> I also tried combining the two IdentityFile lines together like so
> >>> (for some
> >>> reason):
> >>>
> >>> Host bitucket . org
> >>> IdentityFile ~/.ssh/id_rsa1
> >>> IdentityFile ~/.ssh/id_rsa
> >>>
> >>> I have even tried running ssh-agent . exe, adding id_rsa1 to that
> >>> and then running the git clone with no result.
> >>>
> >>> The weird thing is, I have two public keys as well and they both
> >>> load in the ssh . exe (they return errors about format), I just
> >>> cannot get my ssh . exe to work with multiple private keys.
> >>>
> >>> Has anyone got any ideas on how to solve this?
Sam Millman· Jan 10, 2018, 16:26 UTC · re: Randall S. Becker · lore

Does the ssh.exe come from OpenSSH? I thought it was Git's implementation of the SSH protocol

On 10 January 2018 at 16:23, Randall S. Becker <rsbecker@nexbridge.com> wrote:
Show 137 quoted lines
> May I, with respect, ask you to take this to the OpenSSH email list? (openssh-unix-dev@mindrot.org)  I think the discussion better belongs there and you're likely to get more detailed information from that team.
> Sincerely,
> Randall
>
>> -----Original Message-----
>> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On
>> Behalf Of Sam Millman
>> Sent: January 10, 2018 11:03 AM
>> To: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
>> Cc: git@vger.kernel.org
>> Subject: Re: How to use multiple SSH keys on Git exe (not bash)
>>
>> I actually played a bit more and got this:
>>
>> Host *
>> IdentityFile ~/.ssh/id_rsa_d
>> IdentityFile ~/.ssh/id_rsa
>>
>> Host bitbucket_1
>> User git
>> HostName bitbucket.org
>> IdentityFile ~/.ssh/id_rsa_d
>>
>> Host bitbucket_2
>> User git
>> HostName bitbucket.org
>> IdentityFile ~/.ssh/id_rsa
>>
>> And from basic testing it seems to actually work, it seems it is the Host * that
>> make sit work and it will actually iterate the keys and try them.
>>
>> Not sure why this is, any thoughts?
>>
>> On 10 January 2018 at 15:58, Ævar Arnfjörð Bjarmason <avarab@gmail.com>
>> wrote:
>> >
>> > On Wed, Jan 10 2018, Sam Millman jotted:
>> >
>> >> I am trying, for the sake of PhpStorm, to get multiple SSH keys
>> >> working using git . exe, which means no GitBash.
>> >>
>> >> I can get the keys to work just fine with GitBash.
>> >>
>> >> I edited my .ssh/config to look like (I know this is incorrect):
>> >>
>> >> Host bitucket . org
>> >> IdentityFile ~/.ssh/id_rsa1
>> >>
>> >> Host bitbucket . org
>> >> IdentityFile ~/.ssh/id_rsa
>> >>
>> >>
>> >> And id_rsa1 works, I can actually pick from the other repo. But, of
>> >> course, id_rsa does not now.
>> >>
>> >> I change to:
>> >>
>> >> Host bitucket . org-dd
>> >> HostName bitbucket . org
>> >> IdentityFile ~/.ssh/id_rsa1
>> >>
>> >> Host bitbucket . org-sas
>> >> HostName bitbucket . org
>> >> IdentityFile ~/.ssh/id_rsa
>> >>
>> >> And now only id_rsa works.
>> >>
>> >> I also tried combining the two IdentityFile lines together like so
>> >> (for some reason):
>> >>
>> >> Host bitucket . org
>> >> IdentityFile ~/.ssh/id_rsa1
>> >> IdentityFile ~/.ssh/id_rsa
>> >>
>> >> I have even tried running ssh-agent . exe, adding id_rsa1 to that and
>> >> then running the git clone with no result.
>> >>
>> >> The weird thing is, I have two public keys as well and they both load
>> >> in the ssh . exe (they return errors about format), I just cannot get
>> >> my ssh . exe to work with multiple private keys.
>> >
>> > This might just be a special case of the problem of some hosting
>> > providers picking only the first key you provide, as described in this
>> > thread:
>> > https://public-inbox.org/git/20180103102840.27897-1-avarab@gmail.com/
>> >
>> > If so, you either need to hack around this with ssh host aliases, or a
>> > custom GIT_SSH_COMMAND.
>> >
>> >> On 10 January 2018 at 15:29, Sam Millman <sam.millman@gmail.com>
>> wrote:
>> >>> I am trying, for the sake of PhpStorm, to get multiple SSH keys
>> >>> working using git . exe, which means no GitBash.
>> >>>
>> >>> I can get the keys to work just fine with GitBash.
>> >>>
>> >>> I edited my .ssh/config to look like (I know this is incorrect):
>> >>>
>> >>> Host bitucket . org
>> >>> IdentityFile ~/.ssh/id_rsa1
>> >>>
>> >>> Host bitbucket . org
>> >>> IdentityFile ~/.ssh/id_rsa
>> >>>
>> >>>
>> >>> And id_rsa1 works, I can actually pick from the other repo. But, of
>> >>> course, id_rsa does not now.
>> >>>
>> >>> I change to:
>> >>>
>> >>> Host bitucket . org-dd
>> >>> HostName bitbucket . org
>> >>> IdentityFile ~/.ssh/id_rsa1
>> >>>
>> >>> Host bitbucket . org-sas
>> >>> HostName bitbucket . org
>> >>> IdentityFile ~/.ssh/id_rsa
>> >>>
>> >>> And now only id_rsa works.
>> >>>
>> >>> I also tried combining the two IdentityFile lines together like so
>> >>> (for some
>> >>> reason):
>> >>>
>> >>> Host bitucket . org
>> >>> IdentityFile ~/.ssh/id_rsa1
>> >>> IdentityFile ~/.ssh/id_rsa
>> >>>
>> >>> I have even tried running ssh-agent . exe, adding id_rsa1 to that
>> >>> and then running the git clone with no result.
>> >>>
>> >>> The weird thing is, I have two public keys as well and they both
>> >>> load in the ssh . exe (they return errors about format), I just
>> >>> cannot get my ssh . exe to work with multiple private keys.
>> >>>
>> >>> Has anyone got any ideas on how to solve this?
>
Randall S. Becker· Jan 10, 2018, 16:29 UTC · re: Sam Millman · lore

RE: How to use multiple SSH keys on Git exe (not bash)

OpenSSH generally. Other providers (and platform providers) exist as well. It is hard to know which is really involved, but not git.
Show 154 quoted lines
> -----Original Message-----
> From: Sam Millman [mailto:sam.millman@gmail.com]
> Sent: January 10, 2018 11:26 AM
> To: Randall S. Becker <rsbecker@nexbridge.com>
> Cc: Ævar Arnfjörð Bjarmason <avarab@gmail.com>; git@vger.kernel.org
> Subject: Re: How to use multiple SSH keys on Git exe (not bash)
> 
> Does the ssh.exe come from OpenSSH? I thought it was Git's implementation
> of the SSH protocol
> 
> On 10 January 2018 at 16:23, Randall S. Becker <rsbecker@nexbridge.com>
> wrote:
> > May I, with respect, ask you to take this to the OpenSSH email list?
> (openssh-unix-dev@mindrot.org)  I think the discussion better belongs there
> and you're likely to get more detailed information from that team.
> > Sincerely,
> > Randall
> >
> >> -----Original Message-----
> >> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On
> >> Behalf Of Sam Millman
> >> Sent: January 10, 2018 11:03 AM
> >> To: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> >> Cc: git@vger.kernel.org
> >> Subject: Re: How to use multiple SSH keys on Git exe (not bash)
> >>
> >> I actually played a bit more and got this:
> >>
> >> Host *
> >> IdentityFile ~/.ssh/id_rsa_d
> >> IdentityFile ~/.ssh/id_rsa
> >>
> >> Host bitbucket_1
> >> User git
> >> HostName bitbucket.org
> >> IdentityFile ~/.ssh/id_rsa_d
> >>
> >> Host bitbucket_2
> >> User git
> >> HostName bitbucket.org
> >> IdentityFile ~/.ssh/id_rsa
> >>
> >> And from basic testing it seems to actually work, it seems it is the
> >> Host * that make sit work and it will actually iterate the keys and try them.
> >>
> >> Not sure why this is, any thoughts?
> >>
> >> On 10 January 2018 at 15:58, Ævar Arnfjörð Bjarmason
> >> <avarab@gmail.com>
> >> wrote:
> >> >
> >> > On Wed, Jan 10 2018, Sam Millman jotted:
> >> >
> >> >> I am trying, for the sake of PhpStorm, to get multiple SSH keys
> >> >> working using git . exe, which means no GitBash.
> >> >>
> >> >> I can get the keys to work just fine with GitBash.
> >> >>
> >> >> I edited my .ssh/config to look like (I know this is incorrect):
> >> >>
> >> >> Host bitucket . org
> >> >> IdentityFile ~/.ssh/id_rsa1
> >> >>
> >> >> Host bitbucket . org
> >> >> IdentityFile ~/.ssh/id_rsa
> >> >>
> >> >>
> >> >> And id_rsa1 works, I can actually pick from the other repo. But,
> >> >> of course, id_rsa does not now.
> >> >>
> >> >> I change to:
> >> >>
> >> >> Host bitucket . org-dd
> >> >> HostName bitbucket . org
> >> >> IdentityFile ~/.ssh/id_rsa1
> >> >>
> >> >> Host bitbucket . org-sas
> >> >> HostName bitbucket . org
> >> >> IdentityFile ~/.ssh/id_rsa
> >> >>
> >> >> And now only id_rsa works.
> >> >>
> >> >> I also tried combining the two IdentityFile lines together like so
> >> >> (for some reason):
> >> >>
> >> >> Host bitucket . org
> >> >> IdentityFile ~/.ssh/id_rsa1
> >> >> IdentityFile ~/.ssh/id_rsa
> >> >>
> >> >> I have even tried running ssh-agent . exe, adding id_rsa1 to that
> >> >> and then running the git clone with no result.
> >> >>
> >> >> The weird thing is, I have two public keys as well and they both
> >> >> load in the ssh . exe (they return errors about format), I just
> >> >> cannot get my ssh . exe to work with multiple private keys.
> >> >
> >> > This might just be a special case of the problem of some hosting
> >> > providers picking only the first key you provide, as described in
> >> > this
> >> > thread:
> >> > https://public-inbox.org/git/20180103102840.27897-1-avarab@gmail.co
> >> > m/
> >> >
> >> > If so, you either need to hack around this with ssh host aliases,
> >> > or a custom GIT_SSH_COMMAND.
> >> >
> >> >> On 10 January 2018 at 15:29, Sam Millman <sam.millman@gmail.com>
> >> wrote:
> >> >>> I am trying, for the sake of PhpStorm, to get multiple SSH keys
> >> >>> working using git . exe, which means no GitBash.
> >> >>>
> >> >>> I can get the keys to work just fine with GitBash.
> >> >>>
> >> >>> I edited my .ssh/config to look like (I know this is incorrect):
> >> >>>
> >> >>> Host bitucket . org
> >> >>> IdentityFile ~/.ssh/id_rsa1
> >> >>>
> >> >>> Host bitbucket . org
> >> >>> IdentityFile ~/.ssh/id_rsa
> >> >>>
> >> >>>
> >> >>> And id_rsa1 works, I can actually pick from the other repo. But,
> >> >>> of course, id_rsa does not now.
> >> >>>
> >> >>> I change to:
> >> >>>
> >> >>> Host bitucket . org-dd
> >> >>> HostName bitbucket . org
> >> >>> IdentityFile ~/.ssh/id_rsa1
> >> >>>
> >> >>> Host bitbucket . org-sas
> >> >>> HostName bitbucket . org
> >> >>> IdentityFile ~/.ssh/id_rsa
> >> >>>
> >> >>> And now only id_rsa works.
> >> >>>
> >> >>> I also tried combining the two IdentityFile lines together like
> >> >>> so (for some
> >> >>> reason):
> >> >>>
> >> >>> Host bitucket . org
> >> >>> IdentityFile ~/.ssh/id_rsa1
> >> >>> IdentityFile ~/.ssh/id_rsa
> >> >>>
> >> >>> I have even tried running ssh-agent . exe, adding id_rsa1 to that
> >> >>> and then running the git clone with no result.
> >> >>>
> >> >>> The weird thing is, I have two public keys as well and they both
> >> >>> load in the ssh . exe (they return errors about format), I just
> >> >>> cannot get my ssh . exe to work with multiple private keys.
> >> >>>
> >> >>> Has anyone got any ideas on how to solve this?
> >
Sam Millman· Jan 10, 2018, 16:32 UTC · re: Randall S. Becker · lore
Aha, thanks, I'll go annoy them :P
On 10 January 2018 at 16:29, Randall S. Becker <rsbecker@nexbridge.com> wrote:
Show 157 quoted lines
> OpenSSH generally. Other providers (and platform providers) exist as well. It is hard to know which is really involved, but not git.
>
>> -----Original Message-----
>> From: Sam Millman [mailto:sam.millman@gmail.com]
>> Sent: January 10, 2018 11:26 AM
>> To: Randall S. Becker <rsbecker@nexbridge.com>
>> Cc: Ævar Arnfjörð Bjarmason <avarab@gmail.com>; git@vger.kernel.org
>> Subject: Re: How to use multiple SSH keys on Git exe (not bash)
>>
>> Does the ssh.exe come from OpenSSH? I thought it was Git's implementation
>> of the SSH protocol
>>
>> On 10 January 2018 at 16:23, Randall S. Becker <rsbecker@nexbridge.com>
>> wrote:
>> > May I, with respect, ask you to take this to the OpenSSH email list?
>> (openssh-unix-dev@mindrot.org)  I think the discussion better belongs there
>> and you're likely to get more detailed information from that team.
>> > Sincerely,
>> > Randall
>> >
>> >> -----Original Message-----
>> >> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On
>> >> Behalf Of Sam Millman
>> >> Sent: January 10, 2018 11:03 AM
>> >> To: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
>> >> Cc: git@vger.kernel.org
>> >> Subject: Re: How to use multiple SSH keys on Git exe (not bash)
>> >>
>> >> I actually played a bit more and got this:
>> >>
>> >> Host *
>> >> IdentityFile ~/.ssh/id_rsa_d
>> >> IdentityFile ~/.ssh/id_rsa
>> >>
>> >> Host bitbucket_1
>> >> User git
>> >> HostName bitbucket.org
>> >> IdentityFile ~/.ssh/id_rsa_d
>> >>
>> >> Host bitbucket_2
>> >> User git
>> >> HostName bitbucket.org
>> >> IdentityFile ~/.ssh/id_rsa
>> >>
>> >> And from basic testing it seems to actually work, it seems it is the
>> >> Host * that make sit work and it will actually iterate the keys and try them.
>> >>
>> >> Not sure why this is, any thoughts?
>> >>
>> >> On 10 January 2018 at 15:58, Ævar Arnfjörð Bjarmason
>> >> <avarab@gmail.com>
>> >> wrote:
>> >> >
>> >> > On Wed, Jan 10 2018, Sam Millman jotted:
>> >> >
>> >> >> I am trying, for the sake of PhpStorm, to get multiple SSH keys
>> >> >> working using git . exe, which means no GitBash.
>> >> >>
>> >> >> I can get the keys to work just fine with GitBash.
>> >> >>
>> >> >> I edited my .ssh/config to look like (I know this is incorrect):
>> >> >>
>> >> >> Host bitucket . org
>> >> >> IdentityFile ~/.ssh/id_rsa1
>> >> >>
>> >> >> Host bitbucket . org
>> >> >> IdentityFile ~/.ssh/id_rsa
>> >> >>
>> >> >>
>> >> >> And id_rsa1 works, I can actually pick from the other repo. But,
>> >> >> of course, id_rsa does not now.
>> >> >>
>> >> >> I change to:
>> >> >>
>> >> >> Host bitucket . org-dd
>> >> >> HostName bitbucket . org
>> >> >> IdentityFile ~/.ssh/id_rsa1
>> >> >>
>> >> >> Host bitbucket . org-sas
>> >> >> HostName bitbucket . org
>> >> >> IdentityFile ~/.ssh/id_rsa
>> >> >>
>> >> >> And now only id_rsa works.
>> >> >>
>> >> >> I also tried combining the two IdentityFile lines together like so
>> >> >> (for some reason):
>> >> >>
>> >> >> Host bitucket . org
>> >> >> IdentityFile ~/.ssh/id_rsa1
>> >> >> IdentityFile ~/.ssh/id_rsa
>> >> >>
>> >> >> I have even tried running ssh-agent . exe, adding id_rsa1 to that
>> >> >> and then running the git clone with no result.
>> >> >>
>> >> >> The weird thing is, I have two public keys as well and they both
>> >> >> load in the ssh . exe (they return errors about format), I just
>> >> >> cannot get my ssh . exe to work with multiple private keys.
>> >> >
>> >> > This might just be a special case of the problem of some hosting
>> >> > providers picking only the first key you provide, as described in
>> >> > this
>> >> > thread:
>> >> > https://public-inbox.org/git/20180103102840.27897-1-avarab@gmail.co
>> >> > m/
>> >> >
>> >> > If so, you either need to hack around this with ssh host aliases,
>> >> > or a custom GIT_SSH_COMMAND.
>> >> >
>> >> >> On 10 January 2018 at 15:29, Sam Millman <sam.millman@gmail.com>
>> >> wrote:
>> >> >>> I am trying, for the sake of PhpStorm, to get multiple SSH keys
>> >> >>> working using git . exe, which means no GitBash.
>> >> >>>
>> >> >>> I can get the keys to work just fine with GitBash.
>> >> >>>
>> >> >>> I edited my .ssh/config to look like (I know this is incorrect):
>> >> >>>
>> >> >>> Host bitucket . org
>> >> >>> IdentityFile ~/.ssh/id_rsa1
>> >> >>>
>> >> >>> Host bitbucket . org
>> >> >>> IdentityFile ~/.ssh/id_rsa
>> >> >>>
>> >> >>>
>> >> >>> And id_rsa1 works, I can actually pick from the other repo. But,
>> >> >>> of course, id_rsa does not now.
>> >> >>>
>> >> >>> I change to:
>> >> >>>
>> >> >>> Host bitucket . org-dd
>> >> >>> HostName bitbucket . org
>> >> >>> IdentityFile ~/.ssh/id_rsa1
>> >> >>>
>> >> >>> Host bitbucket . org-sas
>> >> >>> HostName bitbucket . org
>> >> >>> IdentityFile ~/.ssh/id_rsa
>> >> >>>
>> >> >>> And now only id_rsa works.
>> >> >>>
>> >> >>> I also tried combining the two IdentityFile lines together like
>> >> >>> so (for some
>> >> >>> reason):
>> >> >>>
>> >> >>> Host bitucket . org
>> >> >>> IdentityFile ~/.ssh/id_rsa1
>> >> >>> IdentityFile ~/.ssh/id_rsa
>> >> >>>
>> >> >>> I have even tried running ssh-agent . exe, adding id_rsa1 to that
>> >> >>> and then running the git clone with no result.
>> >> >>>
>> >> >>> The weird thing is, I have two public keys as well and they both
>> >> >>> load in the ssh . exe (they return errors about format), I just
>> >> >>> cannot get my ssh . exe to work with multiple private keys.
>> >> >>>
>> >> >>> Has anyone got any ideas on how to solve this?
>> >
>

← back to recent threads