Name for initial branch is ignored when repository is cloned with SSH
- From
- Yasuhiro 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]