git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
To: Jeff King <peff@peff.net>
Cc: Philippe Blain <levraiphilippeblain@gmail.com>,
	Kevin Phillips <thefriendlycoder@gmail.com>,
	git@vger.kernel.org, Jonathan Tan <jonathantanmy@google.com>,
	Emily Shaffer <emilyshaffer@google.com>,
	Brandon Williams <bwilliamseng@gmail.com>,
	"brian m . carlson" <sandals@crustytoothpaste.net>
Subject: Re: Weird interaction between Git protocol versions and git:// and https:// URLs (was: Re: Bug with Git shallow clones and submodules)
Date: Sat, 4 Sep 2021 10:51:22 -0400	[thread overview]
Message-ID: <20210904145122.4glsdicbx56cs3ji@meerkat.local> (raw)
In-Reply-To: <YTNtVJy6sCfQ7T3L@coredump.intra.peff.net>

On Sat, Sep 04, 2021 at 08:57:56AM -0400, Jeff King wrote:
> The server has to be configured correctly at the HTTP level, too. The v2
> probe for HTTP is a "Git-Protocol: version=2" header in the HTTP
> request. The webserver has to be configured to communicate that to the
> rest of Git somehow. In our test setup for Apache, we do:
> 
>   SetEnvIf Git-Protocol ".*" GIT_PROTOCOL=$0
> 
> If that doesn't happen, then the server doesn't see the header at all,
> and just speaks v0 as usual.
> 
> I suspect this could be better documented.

Indeed, I was surprised to find out that all this time we were serving v0 for
http requests. /o\

For the record, the magic nginx+uwsgi incantation is:

    uwsgi_param GIT_PROTOCOL $http_git_protocol;

that gets us what we want:

    $ GIT_TRACE_PACKET=1 GIT_TRACE_BARE=1 git ls-remote https://git.kernel.org/pub/scm/git/git.git 2>&1 | grep version
    packet:          git< version 2
    packet:          git< version 2
    packet:          git< version 2

I will submit a patch for the docs to indicate that this is required, because
right now the only mention of GIT_PROTOCOL env variable are for the file://
and ssh:// schemes.

-K

      reply	other threads:[~2021-09-04 14:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 14:59 Bug with Git shallow clones and submodules Kevin Phillips
2021-08-15 14:31 ` Philippe Blain
2021-09-02 13:49   ` Weird interaction between Git protocol versions and git:// and https:// URLs (was: Re: Bug with Git shallow clones and submodules) Philippe Blain
2021-09-04 12:57     ` Jeff King
2021-09-04 14:51       ` Konstantin Ryabitsev [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210904145122.4glsdicbx56cs3ji@meerkat.local \
    --to=konstantin@linuxfoundation.org \
    --cc=bwilliamseng@gmail.com \
    --cc=emilyshaffer@google.com \
    --cc=git@vger.kernel.org \
    --cc=jonathantanmy@google.com \
    --cc=levraiphilippeblain@gmail.com \
    --cc=peff@peff.net \
    --cc=sandals@crustytoothpaste.net \
    --cc=thefriendlycoder@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.
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 NNTP newsgroup(s).