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

Cannot reduce repository size

mathiagr July 20, 2020

Since my last push, my repo is above 2 GB and I followed this:

 

https://support.atlassian.com/bitbucket-cloud/docs/reduce-repository-size/?_ga=2.260898062.2090672804.1595231747-461398322.1584717325

 

  1. Create a temporary branch to keep any local commits.

  2. Reset the original branch to the commit just before the bad commit containing the large files.

  3. Push the new head to Bitbucket (rewriting history).

  4. Restore local changes – you won’t be able to push these yet, you’ll need to remove any large files first.

 

I did step 1 and 2, but when I try step 3 I get:

 

Pushing to https://mathiagr@bitbucket.org/mathiagr/bitpet.git

To https://bitbucket.org/mathiagr/bitpet.git

! [rejected]          Mathias -> Adding-portal-to-3D-and-AR-scene (non-fast-forward)

error: failed to push some refs to 'https://mathiagr@bitbucket.org/mathiagr/bitpet.git'

hint: Updates were rejected because a pushed branch tip is behind its remote

hint: counterpart. Check out this branch and integrate the remote changes

hint: (e.g. 'git pull ...') before pushing again.

hint: See the 'Note about fast-forwards' in 'git push --help' for details.

 

 

How come I cannot complete step 3 with errors?

 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 7, 2020

Hi Mathias,

Based on the output that you attached here, it looks that you might have attempted to push without the --force flag. When you do a reset operation locally and then try to push without the --force flag, you will get an error because the remote branch contains commits that the local one doesn't (the commits you reset). In this case, it is only possible to push the branch with the --force flag.

Please keep in mind that the --force flag will force the remote branch to get your local version of the branch. If anyone else has pushed additional commits to this branch that you don't have locally, those will be lost.

I can see in our system that the repo referenced in the output is now below 2 GB, so I assume that you managed to perform the operation and reduce the repo's size?

If you'd like, I can run a git gc on the remote repo to remove any dangling commits, which may further reduce the repo's size, just let me know.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events