Repository size explodes after forced push + housekeeping

Recently, I removed some old commits from this repository using git replace --graft. To make them permanent I applied git filter-repo.

The local size of the repository (more precisely the .git folder) was reduced by this procedure from around 8 GB to 1.3 GB. So far everything is fine. However, after pushing the shrunk repository to GitLab via a forced push, the remote size grew from 8 GB to 9.3 GB. How is that possible? Shouldn’t the forced push overwrite the whole remote repository?

To reduce the remote size, I started a “housekeeping” process which represents to my knowledge the classical git gc command. But it was not successful. Instead of reducing the size, we got a few days later a message that the size limit is reached and we should either buy more space or reduce the repositories size. The repository had a size of 130 GB at that time. No pushes were made since the initial forced push. How is it possible that we end up with 130 GB instead of our 1.2 GB the repository should have? Does anyone has an idea how to avoid this explosion in the future as it wasn’t the first time we experienced this issue?

As a workaround, after the unsuccessful housekeeping we uploaded an object map to GitLab and performed a repository cleanup. This yielded to the correct size of 1.2 GB. However, at the first time we encountered this issue we directly uploaded the commit-map created by git filter-repo and had no success either. Therefore, I tried it this time with a forced push. But something is strange here as the housekeeping shouldn’t increase the repositories size. I hope someone can help us to avoid this situation in the future.

By the way, we use and no self-hosted instance.