0

I had an iOS repo on bitbucket and reached a limit of 4Gb. The repo started to deny any commits.

I decided to remove Pods folder using one of these instructions:

Remove folder and its contents from git/GitHub's history

https://stellarflavor.com/2021/12/25/how-to-remove-pushed-pods-folder-from-git-repository/

The repo denied "force push" even if it reduces the repo size so I decided to drop all existing commits to the initial one which contains one small file (.gitignore).

The problem is I reduced repo size to acceptable limit but the .git folder is still huge (more than 99% of whole repo size even when git history is fully dropped). Why does it happen and how to fix it?

8
  • 1
    Did you call garbage collection since you cleaned history? (git gc [--aggressive], doc here) Commented Mar 28, 2024 at 15:08
  • 2
    GC is only on a local directory, not on any remote, so running git gc on your system won't affect Bitbucket's copy. If Bitbucket is rejecting new pushes because their copy of the repo is too large, then you need to talk to them. Commented Mar 28, 2024 at 17:07
  • You need to shrink the size of the remote repository. A remote repository has refs invisible to the users. They refer to git data and therefore the data can't be cleaned up. A hosting service is expected to provide a housekeeping task that helps the user to clean up the repository hosted in their server. A workaround is to create a new repository and push the new branches to it. Commented Mar 29, 2024 at 2:15
  • @JimRedmond I found out how to solve it. I got an error on push so I cloned this repo into another folder and performed some "force push" commands to clean everything but initial commit. Then I switched back to the local repo with deleted Pods folder and performed "force push" again. Currently it works but this "git garbage" still wastes free local and remote disk space. Commented Mar 29, 2024 at 7:05
  • @ElpieKay if I had created a new repo It means dropping project commit history. It is possible but is worse than the current solution with "garbage" persisting inside repo Commented Mar 29, 2024 at 7:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.