You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
remote: Learn how to reduce your repository size: https://support.atlassian.com/bitbucket-cloud/docs/reduce-repository-size/#Rewind-history-to-undo-large-commits.
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://bitbucket.org/....git'
I can not push due to reaching the sit limit of the repo.
How can I delete the big files/folders and push the commit, or i want to add folders to gitignore so I can skip them and free up space, is it possible?
size: 1018.52 MiB
size-pack: 3.65 GiB
size-garbage: 0 bytes
I ran a git gc for this repo and its size has been reduced to 2.1 GB.
You and your team should be able to push now. However, I would advise reducing the repo's size further, if possible.
You can check this post of mine in a different question with more details:
If you decide to proceed with the steps mentioned in that post and rewrite history in the repo with BFG, please keep in mind that the repo's size will get increased again once you push your changes. The repo will then need another git gc for the old commits (prior to history rewrite) to get removed and to get its size reduced. You can let me know here, and I can run another git gc for the repo.
We have a feature request for allowing users to trigger a git gc for their remote repos that you can vote for and add yourself as a watcher:
Just a heads up, I removed the workspace-id and repo name from your post to protect your privacy.
Hi @Rafael Berrospi,
The repo size may go up if you rewrite history and push to Bitbucket. This is because the remote repo will contain both old and new references, and it will need another git gc. I can run it if you let me know after you push, and then the repo's size should get reduced (provided that you pushed a repo of a smaller size).
Please see the following two options I explain below, and take a backup of the repo (a clone with the --mirror flag) before you push any changes so that you can recover the repo if anything goes wrong.
If that folder is committed to a branch named e.g. feature, and
- you haven't added more commits to this branch (so, the commit with the large folder is the last one on this feature branch) and
- you haven't merged this branch into any other branches
then you can:
git reset --soft HEAD~1
git push --force
If the conditions I listed in Option 1 are not met, it's best to rewrite history with BFG. BFG has an option --delete-folders that can be used to remove a folder from the repo's history. You can check more details here: