git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sheik <sahibzone@gmail.com>
To: git@vger.kernel.org
Subject: Repository cloned using SSH does not respect bare repository initial branch
Date: Thu, 26 Oct 2023 07:36:36 +1100	[thread overview]
Message-ID: <63eb269e-72b9-4830-98fc-aeef8b8180d7@gmail.com> (raw)

Hi Maintainers,

Repository cloned using SSH does not use the branch configured in the 
bare repository however repository cloned using filesystem does as 
expected. Shouldn't they both behave the same?


Thanks
Sheik


Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)

#Create bare repository
     su - $user
     git init --bare --initial-branch=test test.git

#Clone repository
     git clone ssh://$user@$computer:/home/$user/test.git test1
     cd test1

     git remote show origin
     #Output [ORIGIN1]

     echo abc >> abc.txt && git add * && git commit -a -m test && git push
     #Output...
     #* [new branch]      master -> master

     git remote show origin
     #Output [ORIGIN2]

What did you expect to happen? (Expected behavior)
Repository cloned using ssh should push to test branch just like 
repository cloned using filesystem does below as configured in the bare 
repository.

#Clone repository
     git clone home/$user/test.git test2

     git remote show origin
     #Output [ORIGIN3]

     echo abc >> abc.txt && git add * && git commit -a -m test && git push

     #Output...
     #* [new branch]      test -> test

     git remote show origin
     #Output [ORIGIN4]

What happened instead? (Actual behavior)
Repository cloned using ssh pushed to master branch disregarding 
configuration in bare repository.

What's different between what you expected and what actually happened?
For ssh cloned repository test branch should been the default branch 
however master was the default.

Anything else you want to add:

[ORIGIN1]
* remote origin
   HEAD branch: (unknown)
   Local branch configured for 'git pull':
     master merges with remote master

[ORIGIN2]
* remote origin
   HEAD branch: (unknown)
   Remote branch:
     master tracked
   Local branch configured for 'git pull':
     master merges with remote master
   Local ref configured for 'git push':
     master pushes to master (up to date)

[ORIGIN3]
* remote origin
   HEAD branch: (unknown)
   Local branch configured for 'git pull':
     test merges with remote test

[ORIGIN4]
* remote origin
   HEAD branch: test
   Remote branches:
     master new (next fetch will store in remotes/origin)
     test   tracked
   Local branch configured for 'git pull':
     test merges with remote test
   Local ref configured for 'git push':
     test pushes to test (up to date)

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.42.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 6.5.0-2-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.5.6-1 
(2023-10-07) x86_64
compiler info: gnuc: 13.2
libc info: glibc: 2.37
$SHELL (typically, interactive shell): /bin/bash


[Enabled Hooks]


             reply	other threads:[~2023-10-25 20:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25 20:36 Sheik [this message]
2023-10-30  9:36 ` Repository cloned using SSH does not respect bare repository initial branch Jeff King
2023-10-30 15:24   ` Sheik
2023-10-30 17:43     ` Jeff King
2023-10-30 23:30       ` Sheik
2023-10-31  2:38         ` Sheik
2023-10-30 15:33   ` Sheik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=63eb269e-72b9-4830-98fc-aeef8b8180d7@gmail.com \
    --to=sahibzone@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).