From: Marc Branchaud Date: Fri, 15 Mar 2024 13:49:35 GMT Subject: sshd support for Git protocol v2 (was: Re: Name for initial branch is ignored when repository is cloned with SSH) 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: > 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.