Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Repository is over the size limit (4 GB) and will not accept further additions.


remote: Learn how to reduce your repository size:
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to ''

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?


More details: 

count: 4875
size: 1018.52 MiB
in-pack: 10075
packs: 3
size-pack: 3.65 GiB
prune-packable: 4808
garbage: 0
size-garbage: 0 bytes

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jan 09, 2023

Hi Rafael,

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.

Kind regards,

Good afternoon, what happened was that we have a folder which contains too many static files which we now want to include in the .gitignore and push again.

That way there would be no problem? Or will it go back to the previous size? Please tell me to proceed in this way.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jan 10, 2023

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.

Option 1

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:

  1. Checkout this branch locally
  2. Reset the last commit with
    git reset --soft HEAD~1
  3. Push that branch to Bitbucket with
    git push --force

Option 2

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:

Kind regards,

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events