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

RE: [BUG] git clone from bundle with --all does not fetch all refs

From
AHAndrew Harmon <aharmon@signalquest.com>
Date
Oct 7, 2025, 23:11 UTC
Message-ID
<BL3PR13MB520981A726145113DCA8B910BBE0A@BL3PR13MB5209.namprd13.prod.outlook.com>
In-Reply-To
<xmqqa522icjy.fsf@gitster.g>
Hi Junio,
Thanks for the reply. I'm a bit out of my depth but tried to write a good bug report.
The experience of "cloning from bundle should be just like cloning from github" did not happen for me. Maybe I created the bundle wrong?
See the workflow, below. Is the problem that refs are put in the bundle at refs/remotes/origin/* instead of refs/heads/*?

user@machine MINGW64 ~ $ mkdir tmp

user@machine MINGW64 ~ $ cd tmp

user@machine MINGW64 ~/tmp $ git clone git@GITLAB_HOST:external_sources/matrice_sq.git Cloning into 'matrice_sq'... remote: Enumerating objects: 1512, done. remote: Counting objects: 100% (139/139), done. remote: Compressing objects: 100% (137/137), done. remote: Total 1512 (delta 79), reused 0 (delta 0), pack-reused 1373 (from 1) Receiving objects: 100% (1512/1512), 537.88 KiB | 4.68 MiB/s, done. Resolving deltas: 100% (1070/1070), done.

user@machine MINGW64 ~/tmp $ cd matrice_sq

user@machine MINGW64 ~/tmp/matrice_sq (develop)
$ git branch -r
  origin/21-Add-benchmark-application
  origin/51-inlining-config-matrix-base
  origin/Add_readme
  origin/DspCortexM4
  origin/HEAD -> origin/develop
  origin/develop
  origin/master
  origin/wip-develop-no-inline
  origin/wip-expression-templates
  origin/wip-inlining-config
  origin/wip-kf-imu-gm-states
  origin/wip-nested-submatrix-tests
  origin/wip-sqinav-initial-version
  origin/wip/matrix-base-public-operators
  origin/wip_ins_resource_investigation

user@machine MINGW64 ~/tmp/matrice_sq (develop) $ git bundle create ../matrice_sq.bundle --all Enumerating objects: 1512, done. Counting objects: 100% (1512/1512), done. Delta compression using up to 16 threads Compressing objects: 100% (435/435), done. Writing objects: 100% (1512/1512), 537.83 KiB | 76.83 MiB/s, done. Total 1512 (delta 1070), reused 1512 (delta 1070), pack-reused 0 (from 0)

user@machine MINGW64 ~/tmp/matrice_sq (develop) $ git bundle verify ../matrice_sq.bundle The bundle contains these 18 refs: 1b32e892e571c11c764e8d79e7970afe89378327 refs/heads/develop 06881c8a501f166b41d71c8a7a025daa5bf768ea refs/remotes/origin/21-Add-benchmark-application b09e56be3d6ae35774544590c1dc8ae88b4d87f9 refs/remotes/origin/51-inlining-config-matrix-base 093d3bff0316e7281ba0b094f7d79e3d16793b15 refs/remotes/origin/Add_readme 241e5d6f6116f8bfae399c766c92d9b2013e61ab refs/remotes/origin/DspCortexM4 1b32e892e571c11c764e8d79e7970afe89378327 refs/remotes/origin/HEAD 1b32e892e571c11c764e8d79e7970afe89378327 refs/remotes/origin/develop 0c6d1fce26af62c104a0c0297b693d9c0f164bdc refs/remotes/origin/master e9afacb6d77e888b29e9ece12863fb13bc8df3ad refs/remotes/origin/wip-develop-no-inline 47004f08fc09bf97f9a12e81726edc05f7390409 refs/remotes/origin/wip-expression-templates 8047b97041ce82d2e6b4e193332ddb1d8337fd84 refs/remotes/origin/wip-inlining-config ed8238c5ab80ec3039a29c65dcec574fca6e7017 refs/remotes/origin/wip-kf-imu-gm-states 4c20baac85dfce2077f9e997f2c5ea4f25392b46 refs/remotes/origin/wip-nested-submatrix-tests e909df72e6e52ece8b7fed9362578e1d4a89fb45 refs/remotes/origin/wip-sqinav-initial-version 9a8ab3d9bcb4a2c2384d0c545634d45e0daf60ed refs/remotes/origin/wip/matrix-base-public-operators 8720c64e04aeeef02f54a611665f9b0777e8572c refs/remotes/origin/wip_ins_resource_investigation 0c6d1fce26af62c104a0c0297b693d9c0f164bdc refs/tags/Matrice-SQ-v1.0.0 1b32e892e571c11c764e8d79e7970afe89378327 HEAD The bundle records a complete history. The bundle uses this hash algorithm: sha1 ../matrice_sq.bundle is okay

user@machine MINGW64 ~/tmp/matrice_sq (develop) $ cd ..

user@machine MINGW64 ~/tmp $ git clone matrice_sq.bundle matrice_copy Cloning into 'matrice_copy'... Receiving objects: 100% (1512/1512), 537.83 KiB | 11.69 MiB/s, done. Resolving deltas: 100% (1070/1070), done.

user@machine MINGW64 ~/tmp $ cd matrice_copy

user@machine MINGW64 ~/tmp/matrice_copy (develop)
$ git branch -r
  origin/HEAD -> origin/develop
  origin/develop
>>>>> At this point, I would expect to see everything from origin that I normally get when cloning from gitlab, but I don't.
-----Original Message-----
From: Junio C Hamano <gitster@pobox.com> 
Sent: Tuesday, October 7, 2025 18:15
To: Andrew Harmon <aharmon@signalquest.com>
Cc: git@vger.kernel.org
Subject: Re: [BUG] git clone from bundle with --all does not fetch all refs
Andrew Harmon <aharmon@signalquest.com> writes:
Show 19 quoted lines
> # Problem with git bundle --all and git clone for air-gapped transfer 
> to offline environments
>
> ## Description
>
> When creating a bundle using `git bundle create --all`, all refs 
> including `refs/remotes/origin/*` are included in the bundle. However, 
> when cloning from this bundle using `git clone`, these remote refs are 
> not automatically fetched, making many branches inaccessible.
>
> ## Steps to Reproduce
>
> 1. In a repository with multiple branches and remote tracking branches 
> (e.g., after cloning from GitLab/GitHub) 2. Create a bundle: `git 
> bundle create repo.bundle --all` 3. Verify bundle contents: `git 
> bundle list-heads repo.bundle` (shows both `refs/heads/*` and 
> `refs/remotes/origin/*`) 4. Clone from bundle: `git clone repo.bundle 
> cloned-repo` 5. Check available branches: `cd cloned-repo && git 
> branch -a`
> ## Expected Behavior
>
> All refs included in the bundle (both `refs/heads/*` and `refs/remotes/origin/*`) should be accessible after cloning. Users should be able to see and checkout all branches that were in the original repository.
If I am not misreading the scenario presented, then this expectation is wrong.
> ## Actual Behavior
>
> Only refs under `refs/heads/*` in the bundle become remote tracking branches. Refs stored as `refs/remotes/origin/*` in the bundle are not fetched during clone, making these branches inaccessible without manual intervention.
This is totally expected.  Think of cloning from a bundle is just like cloning from the original remote (limited to the refs included in the bundle, of course).  Local branches of the remote (i.e. the ones that corresponds to refs/heads/* you saw in your bundle) become your remote-tracking branches.  Their remote-tracking branches are not even visible, unless you explicitly ask "clone" to.  Which means ...
Show 7 quoted lines
> ## Workaround
>
> After cloning, manually fetch the remote refs:
>
> ```bash
> git fetch origin 'refs/remotes/origin/*:refs/remotes/origin/*'
> ```
... this is not even a workaround, but how you would ask for their remote-tracking branches.
Or
    $ git init && git fetch repo.bndl "refs/*:refs/*"
which is like doing a mirror clone ("git clone --mirror").
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 7 in “[BUG] git clone from bundle with --all does not fetch all refs”
  1. Andrew HarmonOct 7, 2025
  2. Junio C HamanoOct 7, 2025
  3. Andrew HarmonOct 7, 2025
  4. Junio C HamanoOct 8, 2025
  5. Andrew HarmonOct 8, 2025
  6. Andreas SchwabOct 8, 2025
  7. Andrew HarmonOct 8, 2025

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.