possible bug: --bare vs --mirror with respect to remote-tracking branches
From: Sunny Hoang <hidden>
Date: 2022-09-01 11:07:02
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)
git clone <url> --mirror
git --git-dir=<dir> --work-tree=<working directory> branch -r
What did you expect to happen? (Expected behavior)
Remote-tracking for branches is supposed to be included (and would show up in
`git branch -r`)
What happened instead? (Actual behavior)
No remote-tracking branches (`git branch -r` is empty)
What's different between what you expected and what actually happened?
Should see `origin/HEAD`and so on...but it's still empty
Anything else you want to add:
I found the solution here:
https://stackoverflow.com/questions/38981470/git-clone-create-a-bare-clone-but-with-remote-tracking-branches-for-a-worktre
`git config --local --add remote.origin.fetch
"+refs/heads/*:refs/remotes/origin/*"` seems to do it.
The original value was:
[remote "origin"]
...
fetch = +refs/*:refs/*
Running that command added another line:
[remote "origin"]
...
fetch = +refs/*:refs/*
fetch = +refs/heads/*:refs/remotes/origin/*
Running `git remote update` afterwards gets me the desired remote-tracking.
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.37.1
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.18.14-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 23 Jul 2022
11:46:17 +0000 x86_64
compiler info: gnuc: 12.1
libc info: glibc: 2.35
$SHELL (typically, interactive shell): /bin/bash
[Enabled Hooks]