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

Name for initial branch is ignored when repository is cloned with SSH

From
YKYasuhiro Kimura <yasu@utahime.org>
Date
Mar 15, 2024, 01:49 UTC
Message-ID
<20240315.104939.1269594475664662053.yasu@utahime.org>
What did you do before the bug happened? (Steps to reproduce your issue)
1. git init --bare --initial-branch=main /somewhere/test.git
2. git clone ssh://hostname/somewhere/test.git
3. cd test
4. echo foo > foo.txt
5. git add foo.txt
6. git commit -m 'Add foo.txt'
7. git branch -v
What did you expect to happen? (Expected behavior)
% git branch -v
* main 1bd6499 [gone] Add foo.txt
%
What happened instead? (Actual behavior)
% git branch -v
* master 3f0b875 [gone] Add foo.txt
% 
What's different between what you expected and what actually happened?

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.

[System Info] git version: git version 2.44.0 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 compiler info: gnuc: 12.2 libc info: glibc: 2.36 $SHELL (typically, interactive shell): /bin/zsh

[Enabled Hooks]
Next: Jeff King
Message 1 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.