{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreiblsqdc7g6iwuk4qb4jpx52xgten4ry2ik77lhkmfqaeqxiparmze",
    "uri": "at://did:plc:pgryn3ephfd2xgft23qokfzt/app.bsky.feed.post/3mmwzh74vvg42"
  },
  "path": "/t/git-clone-mirror-fails-with-fatal-expected-packfile/176310#post_1",
  "publishedAt": "2026-05-28T21:04:38.000Z",
  "site": "https://discuss.huggingface.co",
  "textContent": "# Summary\n\n`git clone --mirror` consistently fails with `fatal: expected 'packfile'` on non-trivial HuggingFace repos. The same repo clones successfully with `--bare`.\n\n# Reproducer\n\nNo auth, no flags, no env vars:\n\n\n    $ git clone --mirror https://huggingface.co/microsoft/phi-1_5 /tmp/phi-mirror\n    Cloning into bare repository '/tmp/phi-mirror'...\n    fatal: expected 'packfile'\n\n    $ git clone --bare https://huggingface.co/microsoft/phi-1_5 /tmp/phi-bare\n    Cloning into bare repository '/tmp/phi-bare'...\n    remote: Enumerating objects: 237, done.\n    remote: Total 237 (delta 0), reused 0 (delta 0), pack-reused 236 (from 1)\n    Receiving objects: 100% (237/237), 1.22 MiB | 8.36 MiB/s, done.\n    Resolving deltas: 100% (128/128), done.\n\n\n## Observations\n\n  * `--mirror` (fetches all refs including `refs/pr/*`) fails\n  * `--bare` (fetches branches and tags only) succeeds\n  * Tiny repos like `prajjwal1/bert-tiny` work with both flags — the bug only surfaces on repos with non-trivial content or ref counts\n\n\n\n## Environment\n\nReproducible across both client environments we tested:\n\n  * macOS 26.4.1 (Build 25E253), git 2.52.0\n  * Debian GNU/Linux 13 (trixie), git 2.47.3\n\n\n\nReproducible from multiple networks.\n\n## Impact\n\n  * Internal tooling that relied on `--mirror` had to switch to `--bare`.\n  * The error message is also misleading — it reads like a malformed server response rather than a deliberate rejection of the requested ref set.\n\n",
  "title": "Git clone --mirror fails with \"fatal: expected 'packfile'\""
}