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

git clone fails when using --dissociate together with a reference repository that contains a commit-graph

From
DMDaniel Mach <daniel.mach@suse.com>
Date
May 12, 2026, 07:35 UTC
Message-ID
<6ae85515-9373-4c9e-90d2-5e4176590c5b@suse.com>
Hi,
I've stumbled upon a bug that the following command failed:

$ git clone <url> <dir> --reference <old-dir> --dissociate fatal: unable to parse commit <SHA> warning: Clone succeeded, but checkout failed. You can inspect what was checked out with 'git status' and retry with 'git restore --source=HEAD :/'

Omitting --dissociate fixed the error, but it wasn't clear to me what might be the root cause.

$ git --version git version 2.54.0

With the help of AI I was able to create a reproducer (see the attached script). I have verified that the reproducer works and also simplified it.

AI generated report (take it with a grain of salt):
* The Bug: During dissociation, Git correctly repacks objects and 
removes the objects/info/alternates file. However, the git clone process 
has already initialized its object store including the alternate's 
commit-graph.
   After dissociation, it fails to "forget" or reload the object store, 
leading to a crash when it tries to use the commit-graph (which refers 
to the now-unlinked alternate) to perform the initial checkout.
* Proof of state: As shown in the script output, a manual git checkout 
immediately after the failure succeeds, proving the repository is 
structurally sound but the clone process itself was in an inconsistent 
state.
* Workaround: Passing -c core.commitGraph=false to the clone command 
prevents the crash.

regards, Daniel

Next: Jeff King
Message 1 of 2 in “git clone fails when using --dissociate together with a reference repository that contains a commit-graph”
  1. Daniel MachMay 12, 2026
  2. Jeff KingMay 12, 2026

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.