git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Weird interaction between Git protocol versions and git:// and https:// URLs (was: Re: Bug with Git shallow clones and submodules)

From
Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Date
Sep 4, 2021, 14:51 UTC
Message-ID
<20210904145122.4glsdicbx56cs3ji@meerkat.local>
In-Reply-To
<YTNtVJy6sCfQ7T3L@coredump.intra.peff.net>
On Sat, Sep 04, 2021 at 08:57:56AM -0400, Jeff King wrote:
Show 11 quoted lines
> 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
Previous: Jeff King
Message 5 of 5 in “Bug with Git shallow clones and submodules”
  1. Kevin PhillipsAug 11, 2021
  2. Philippe BlainAug 15, 2021
  3. Weird interaction between Git protocol versions and git:// and https:// URLs (was: Re: Bug with Git shallow clones and submodules)Philippe Blain, Sep 2, 2021
  4. Jeff KingSep 4, 2021
  5. Konstantin RyabitsevSep 4, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.