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

Next challenges

Recent achievements

Recognition

  • Give kudos
  • My kudos

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Cannot reduce repository size

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

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
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,903 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you