I have a repo that I’ve just uploaded to codeberg. In earlier versions, I had a ton of media files - they have now been removed. However, when I uploaded the repo to codeberg, I’m getting this notification:

Your private repo uses up a large amount of disk storage, while all content should ideally be public and licensed under an OSI- or FSF-approved Free Software licence. Please refer to our ToS and the FAQ about software licenses and private repositories. Thank you for considering to release this repo to the public or reducing your required disk space for this repo.

Turns out, my pushed files are 1 MB, but the .git folder is 279 MB - how do I slim it down?

  • CameronDev
    link
    fedilink
    arrow-up
    5
    ·
    17 days ago

    Rewrite history. Use git rebase to squash all commits between adding and removing the blobs. Its gross, and if your project is publically used you need to tell everyone what your doing and why.

    • oz1sej@lemmy.worldOP
      link
      fedilink
      arrow-up
      7
      ·
      17 days ago

      Rebase shrunk the .git folder from 280 MB to 267 MB… So in the end, I just deleted the repo AND my local .git folder, created a new repo and uploaded. Now it’s 1,5 MB 😁 Thanks!

  • SleeplessCityLights
    link
    fedilink
    arrow-up
    1
    ·
    17 days ago

    So git tracks the history of your commits and gives you the ability to restore your project to any exact commit. For text files that is efficiently accomplished by only tracking the delta between text on each commit. For binaries, git can only compare file hashes and if the file changes the whole file is uploaded again in full to your history. You probably changed a few 1mb images a bunch of times and now have every copy of it in your git history. Git LFS solves this problem. You can pull the problematic files out with a tool that rewrites history, but rewriting history is usually not great idea, there are too many footguns.