From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Jonathan Nieder" <jrnieder@gmail.com>,
"Brandon Williams" <bmwill@google.com>,
"Jeff King" <peff@peff.net>, "Segev Finer" <segev208@gmail.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: Re: [RFC/PATCH] connect: add GIT_SSH_{SEND,RECEIVE}{,_COMMAND} env variables
Date: Thu, 04 Jan 2018 01:08:28 +0100 [thread overview]
Message-ID: <87bmiacwoz.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <xmqq373mh62r.fsf@gitster.mtv.corp.google.com>
On Wed, Jan 03 2018, Junio C. Hamano jotted:
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> This is useful for talking to systems such as Github or Gitlab that
>> identify user accounts (or deploy keys) by ssh keys. Normally, ssh
>> could do this itself by supplying multiple keys via -i, but that trick
>> doesn't work on these systems as the connection will have already been
>> accepted when the "wrong" key gets rejected.
>
> You need to explain this a lot better than the above.
>
> I am sure systems such as Github have more than dozens of users who
> push over ssh and these users identify themselves by which key to
> use when establishing connection just fine (presumably by using a
> "Host" entry for the github URL in ~/.ssh/config), and presumably we
> are not sending "wrong" keys over there. So there needs to be a lot
> more clear description of the problem you are trying to solve in the
> first place.
Hopefully this is clearer, and depending on how the rest of the
discussion goes I'll submit v2 with something like this in the commit
message:
SSH keys A and B are known to the remote service, and used to identify
two different users.
A can only push to repository X, and B can only fetch from repository Y.
Thus, if you have a script that does:
GIT_SSH_COMMAND="ssh -i A -i B" git ...
It'll always fail for pulling from X, and pushing to Y. Supply:
GIT_SSH_COMMAND="ssh -i B -i A" git ...
And now pulling will work, but pushing won't.
If you were to do, where C is a completly unknown key:
GIT_SSH_COMMAND="ssh -i C -i A" git push X ...
It would work, since ssh wouldn't get far enough in the key negotiation
to drop you into a shell. This is the case you had in mind, but is
unrelated to the problem I'm trying to address.
I tested this on a Gitlab instance, but as far as I know this property
is going to be intrinsic to anything that uses ssh in this way,
i.e. once you get past the step where the server says "this key is OK"
and drops you into a shell, it's not going to retry the whole
negotiation with another key just because the command you ran exited
with non-zero.
So now I just have a GIT_SSH_COMMAND that dispatches to different keys
depending on the operation, as noted in the commit message, and I can
assure you that without that logic it doesn't work.
I thought that use-case might be useful enough to be natively supported,
since right now you either need to hack it up like that, or perform
similar hacks with url/pushurl and ssh host aliases in your config.
next prev parent reply other threads:[~2018-01-04 0:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-03 10:28 [RFC/PATCH] connect: add GIT_SSH_{SEND,RECEIVE}{,_COMMAND} env variables Ævar Arnfjörð Bjarmason
2018-01-03 23:32 ` Junio C Hamano
2018-01-04 0:08 ` Ævar Arnfjörð Bjarmason [this message]
2018-01-04 4:42 ` Jeff King
2018-01-04 10:10 ` Ævar Arnfjörð Bjarmason
2018-01-04 15:53 ` Jeff King
2018-01-04 17:20 ` Ævar Arnfjörð Bjarmason
2018-01-04 19:06 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bmiacwoz.fsf@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=pclouds@gmail.com \
--cc=peff@peff.net \
--cc=segev208@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).