repository size not reduce after gc

Solution 1:

If you start from scratch in a new orphan branch, I would then check the actual size of the repository by cloning the remote repository you just push to.

By cloning the remote in a new local folder, you would then get the actual size of your new repository.

But if that remote repository still includes all the other branches (and not just the new orphan branch), you would still get the large files in past commits.

I would then recommend to:

  • install git filter-repo (python-based)
  • delete any large file in your history: git filter-repo --strip-blobs-bigger-than 2M for instance. (content-based filtering)
  • force push (git push --mirror: make sure to notify any collaborator on that repository)