sashoalm
sashoalm

Reputation: 79487

AWS CodeCommit keeps unreferenced binary blob even though branch was deleted

Let's say I have pushed a branch containing a 100 MB binary blob file to my AWS CodeCommit by mistake, which has now made cloning the repo very slow.

I have deleted the branch containing it, but cloning the repo is still slow, and the binary blob is still there even though I have verified it's unreachable from any branch or commit.

How do I force AWS CodeCommit to garbage-collect it? Or at least, can I count on CodeCommit to eventually garbage-collect it (in two weeks, or whatever time interval it uses)?

Upvotes: 1

Views: 475

Answers (2)

sashoalm
sashoalm

Reputation: 79487

I found the issue, it was with the script from Which commit has this blob?. It was listing commits that reference the blob, but ONLY IF those commits are in the currently checked out branch.

My blob was being referenced by another (different) branch! Once I removed that, the blob disappeared immediately from AWS CodeCommit, so I was wrong to think CodeCommit keeps blobs around even when not referenced.

Upvotes: 0

Code-Apprentice
Code-Apprentice

Reputation: 83527

Or at least, can I count on CodeCommit to eventually garbage-collect it (in two weeks, or whatever time interval it uses)?

Yes, if the blob is truly unreachable, CodeCommit should garbage collect it eventually. Reading the docs for git gc:

When common porcelain operations that create objects are run, they will check whether the repository has grown substantially since the last maintenance, and if so run git gc automatically.

So assuming that CodeCommit executes the code that does this, say by directly executing git add from the command line, then it will run garbage collection automatically.

Upvotes: 1

Related Questions