Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git partial clone: how to disable dynamic object fetching?

Tags:

git

git-clone

I have invoked a Git partial clone to clone a repository without any blobs:

git clone --filter=blob:none https://server/repo.git

Now I would like to experiment with this repository to see which operations are locally possible without Git dynamically fetching missing objects from the promisor remote. Is there some Git config option to disable dynamic fetching and instead let me run into "missing object" errors?

like image 353
mstrap Avatar asked Sep 11 '25 03:09

mstrap


2 Answers

Support for partial clones is still a work in progress, so there may be better solutions for this in the future.

As of right now, Git will only fetch missing objects from promisor remotes. From the documentation:

Dynamic object fetching will only ask promisor remotes for missing objects. We assume that promisor remotes have a complete view of the repository and can satisfy all such requests.

This is listed as a limitation, so it may very well change in the future. However, as of right now, you can use this to your advantage by simply telling Git that the origin remote isn't a promisor by saying:

git config remote.origin.promisor false
like image 153
Enrico Campidoglio Avatar answered Sep 12 '25 17:09

Enrico Campidoglio


I'd go with removing the remote. Either by removing the remote from the .git/config file or running git remote remove origin.

like image 30
toydarian Avatar answered Sep 12 '25 17:09

toydarian