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

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

 



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]




[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