Home > Software design >  Fetch after clone from mirror re-downloads everything
Fetch after clone from mirror re-downloads everything

Time:05-02

I have a local mirror of a remote repo, and a working copy cloned from this local mirror. Now I do fetch on this working copy (against the remote) and expect it to get the recent changes added after the mirror creation. But it appears to be downloading the entire history of everything again, judging by the amount of data being transferred:

git.exe fetch --progress -v "origin"
remote: Enumerating objects: 3443117, done.
remote: Counting objects: 100% (94/94), done.
remote: Compressing objects: 100% (60/60), done.
Receiving objects:  57% (1966278/3443117), 30.85 GiB | 5.32 MiB/s

Can someone please explain what is going on? I guess I am not getting something about the mirror clones, or how the fetch figures out what data needs to be downloaded. I should be able to use whatever data I have locally and only get changes from the remote server, how?

The commands used are not too special:

git clone --mirror --reference c:\WORK\product [email protected]:company/product.git c:\TEST\mirror
cd mirror
git remote update

git clone --progress -v "c:\TEST\mirror" "C:\TEST\working"

I have then replaced origin url on a working copy before the fetch.

Update:

My mirror is missing any and all ref configurations. It makes it through receiving and resolving deltas, but then finishes with "error: Could not fetch origin" and no further details, and apparently the clone ends up being incomplete.

CodePudding user response:

Turned out my mirror was in fact incomplete. I wasn't sure at first if what I am seeing is not correct for a bare repo, and git output didn't make it clear either.

Somehow initial clone did not configure any refs, nor did consequent updates and fetches.

A clean clone without --reference solved the problem for me. Now refs are visible on the mirror, and working copies checked out from it only download newer changes as they should.

  •  Tags:  
  • git
  • Related