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

possible bug: --bare vs --mirror with respect to remote-tracking branches

From
SHSunny Hoang <s7hoang@gmail.com>
Date
Sep 1, 2022, 11:06 UTC
Message-ID
<CAM+t+1aez80vs5939Td0emwqAhVHtKW0BZ412+RW8Tvm85W5eQ@mail.gmail.com>

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]
Message 1 of 1 in “possible bug: --bare vs --mirror with respect to remote-tracking branches”
  1. Sunny HoangSep 1, 2022

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.