title: How to remove big files from old commits in bitbucket
body: <p>my bitbucket repo got very big (1.6 GB) after I did some awful commits some months ago. I did not realized how serious was the situation (noob..), since a collegue tried to clone it and failed (too big).</p>
  
  <p>I read carefully this post <a href="https://stackoverflow.com/questions/1029969/why-is-my-git-repository-so-big">Why is my git repository so big?</a> and did the following (as <a href="https://stackoverflow.com/users/266720/vi">@Vi</a> suggested):</p>
  
  <ul>
  <li><p><strong>Detect fat files in my repo history</strong></p>
  
  <pre><code>git rev-list --all --objects |     sed -n $(git rev-list --objects --all | \
  cut -f1 -d' ' | \
  git cat-file --batch-check | \
  grep blob | \
  sort -n -k 3 | \
  tail -n40 | \
  while read hash type size; do 
   echo -n "-e s/$hash/$size/p ";
  done) |
  sort -n -k1
  </code></pre>
  
  <p>Let's say one of the fat files is <em>mybigfile.gz</em> </p></li>
  <li><p><strong>Delete mybigfile.gz from repo</strong></p>
  
  <pre><code>git filter-branch -f  --index-filter \
  'git rm --force --cached --ignore-unmatch mybigfile.gz' \
  -- --all
  rm -Rf .git/refs/original &amp;&amp; \
  git reflog expire --expire=now --all &amp;&amp; \
  git gc --aggressive &amp;&amp; \
  git prune
  </code></pre></li>
  </ul>
  
  <p>Actually, it worked since now my local repo directory is 850MB.
  The problem is that the remote repository did not change size.
  Then I tried to</p>
  
  <pre><code>git push origin --force --all
  </code></pre>
  
  <p>but the situation got worse, now my remote repo is 2GB!
  How can I solve this awful situation?
  Do you suggest to create a new repo or is there something else I can do to sort it out?</p>
  
  <p>Thank you.</p>
  
  <p><strong>EDIT</strong>: I try to formulate better the problem. Some months ago, I committed  to my repo some big files, several times. When I realised it, I added these files to .gitignore. Then I kept committing to the repo without these file. I was not taking care to the bitbucket warning (your repo is too big). Now, I need to get rid of these files stored in old commits, both locally and remotely. I successfully cleaned up my <em>local</em> git directory with the procedure described above. My problem is that when I push to the remote master branch, the <em>remote</em> repo is not affected by the local clean up.</p>
  
  <p>EDIT 2:
  I tried BFG repo cleaner on my local .git directory</p>
  
  <pre><code>java -jar bfg-1.12.3.jar --strip-blobs-bigger-than 100M
  </code></pre>
  
  <p><a href="http://pastebin.com/phFj6uSh" rel="nofollow noreferrer">here</a> the output.</p>
  
  <p>According to this <a href="https://confluence.atlassian.com/bitbucket/maintaining-a-git-repository-321848291.html#MaintainingaGitRepository-UsingtheBFGtorewritehistory" rel="nofollow noreferrer">tutorial</a>, this should be enough to remove blobs on remote repo, but actually this did not happen. Locally my repo is slim, but remotely is still huge. I think I'm missing just a step, but do not know how to do it. Do you think it is easier to just create a new repo? </p>