We use GitHub to host all my projects, and we've got a 6GB soft-limit. A few days ago, there were many files added to the repository which should not have been added (such as images, movies, etc.) which pushed the repository size to 2.4G:
$ du -sh .git
2,4G .git
These changes were pushed to GitHub, but the Disk Usage there increased by almost 2 times the size of the .git folder. How is that possible? Am I missing something here? I always thought that the size of the repository was the same as the size of the .git
folder.
This is because the objects on the server have not been deleted--they've just been orphaned. Unfortunately, running
git gc --prune=now
locally won't have any affect on the remote server. The good news is, the default prune age is two weeks, and GitHub runs this periodically. This means that any orphaned blobs/commits older than two weeks will be removed.If you want the extra binaries removed immediately, you can go ahead and delete/recreate the repository on GitHub. Make sure you garbage collect locally before pushing to the new repository. Hope this helps!