Git clone --mirror fails with "fatal: expected 'packfile'"
Hugging Face Forums [Unofficial]
May 28, 2026
Summary
git clone --mirror consistently fails with fatal: expected 'packfile' on non-trivial HuggingFace repos. The same repo clones successfully with --bare.
Reproducer
No auth, no flags, no env vars:
$ git clone --mirror https://huggingface.co/microsoft/phi-1_5 /tmp/phi-mirror
Cloning into bare repository '/tmp/phi-mirror'...
fatal: expected 'packfile'
$ git clone --bare https://huggingface.co/microsoft/phi-1_5 /tmp/phi-bare
Cloning into bare repository '/tmp/phi-bare'...
remote: Enumerating objects: 237, done.
remote: Total 237 (delta 0), reused 0 (delta 0), pack-reused 236 (from 1)
Receiving objects: 100% (237/237), 1.22 MiB | 8.36 MiB/s, done.
Resolving deltas: 100% (128/128), done.
Observations
--mirror(fetches all refs includingrefs/pr/*) fails--bare(fetches branches and tags only) succeeds- Tiny repos like
prajjwal1/bert-tinywork with both flags โ the bug only surfaces on repos with non-trivial content or ref counts
Environment
Reproducible across both client environments we tested:
- macOS 26.4.1 (Build 25E253), git 2.52.0
- Debian GNU/Linux 13 (trixie), git 2.47.3
Reproducible from multiple networks.
Impact
- Internal tooling that relied on
--mirrorhad to switch to--bare. - The error message is also misleading โ it reads like a malformed server response rather than a deliberate rejection of the requested ref set.
Discussion in the ATmosphere