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

sshd support for Git protocol v2 (was: Re: Name for initial branch is ignored when repository is cloned with SSH)

From
Marc Branchaud <marcnarc@xiplink.com>
Date
Mar 15, 2024, 13:49 UTC
Message-ID
<4b8823f1-5029-4097-a3d5-ab4a6a02c482@xiplink.com>
In-Reply-To
<20240315054936.GA1741107@coredump.intra.peff.net>
On 2024-03-15 01:49, Jeff King wrote:
Show 29 quoted lines
> On Fri, Mar 15, 2024 at 10:49:39AM +0900, Yasuhiro Kimura wrote:
> 
>> I expect the change is committed to 'main' branch. But actually it is
>> committed to 'master' branch.
>>
>> Anything else you want to add:
>>
>> If I change step 2 as following,
>>
>> 2'. git clone /somewhere/test.git
>>
>> then I get expected behavior.
> 
> I suspect you are running afoul of two things:
> 
>    1. When cloning a totally empty repository, detecting the destination
>       of the unborn HEAD requires a protocol extension. This extension
>       was implemented only for Git's v2 protocol, not for v0.
> 
>    2. Git should automatically use v2 in most cases these days. But it
>       does so by probing the server in a backwards-compatible way to see
>       if it also supports v2. For ssh, that probe happens by passing a
>       special environment variable. However, the default config for many
>       ssh servers refuses unknown variables. For OpenSSH, you'd want to
>       add:
> 
>         AcceptEnv GIT_PROTOCOL
> 
>       to your sshd_config.

I've been the corporate Git Master here for over 15 years, and I was completely unaware of this until today. Thanks for pointing it out! Our internal Git host now finally supports v2!

		M.
Previous: Jeff King
Message 3 of 3 in “Name for initial branch is ignored when repository is cloned with SSH”
  1. Yasuhiro KimuraMar 15, 2024
  2. Jeff KingMar 15, 2024
  3. sshd support for Git protocol v2 (was: Re: Name for initial branch is ignored when repository is cloned with SSH)Marc Branchaud, Mar 15, 2024

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.