Skip to content

Clean up stale `.keep` files

We have recently introduced a metric to report .keep packfiles via Prometheus and our logs. To my surprise, this actually surfaced repositories that have these .keep files, even though Gitaly would never create them. This indicates that those files had likely been created manually, e.g. by an SRE during incidents.

As .keep files tell Git to never delete a packfile marked as such this means that we in fact won't ever get rid of them. This both takes up disk space and makes it less efficient to serve such a repository. We might thus want to grow the logic to delete stale .keep files after a very conservative timeout (multiple weeks, if not months) via CleanupStaleData().

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information