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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 02, 2021 at 09:49:38AM -0400, Philippe Blain wrote:

> > OK, it's running Git 2.20.1. And the list of capabilities above implies that it's responding
> > with protocol v0, even if my local Git version if 2.29, which defaults to protocol v2. If
> > it were responding with protocol v2, we would see:
> > 
> > $ GIT_TRACE_PACKET=1 GIT_TRACE_BARE=1 git ls-remote https://github.com/git/git 2>&1 | grep agent
> > packet:          git< agent=git/github-g78b452413e8b  # server version
> > packet:          git< agent=git/github-g78b452413e8b
> > packet:          git> agent=git/2.29.2  # client version
> > packet:          git< agent=git/2.29.2
> > 
> > And grepping for "version" would confirm it:
> > 
> > $ GIT_TRACE_PACKET=1 GIT_TRACE_BARE=1 git ls-remote https://github.com/git/git 2>&1 | grep version
> > packet:          git< version 2
> > packet:          git< version 2
> > 
> > I can't explain why the server refuses to talk with protocol v2. Maybe Jonathan (CC-ed),
> > who worked on the implementation of protocol v2, would be able to explain that.
> 
> I'm sorry to bump this, but I would really like to understand what is going on here.
> I'm not familiar at all with the protocol code, but my understanding was that after
> Git 2.18, if a client requested protocol v2, the server would answer with v2 (at least
> for git:// and http[s]://, and also for ssh:// if AcceptEnv is correctly configured).
> Here, Git 2.20.1 at https://dpdk.org/git/dpdk-stable answers with v0 for https://,
> but with v2 for git:// !

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. I have to admit that I have
not actually run a regular HTTP server with Git in a long time (at
GitHub, we have our own custom layer that terminates the HTTP
connections).

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux