title: Git pull fatal: Out of memory, malloc failed
body: <p>I've a repo on <a href="https://bitbucket.org/" rel="nofollow noreferrer">https://bitbucket.org/</a></p>
  <p>A few days ago by a mistake big number of image files were pushed in the repo. then files were deleted via another push. After that repo worked OK, but today when I try to pull from the repo:</p>
  <pre><code>$ git pull
  Password for 'https://repo@bitbucket.org': 
  warning: no common commits
  remote: Counting objects: 4635, done.
  remote: Compressing objects: 100% (1710/1710), done.
  fatal: Out of memory, malloc failed (tried to allocate 4266852665 bytes)
  fatal: index-pack failed  
  </code></pre>
  <p>I've tried:</p>
  <ol>
  <li><code>git config --global pack.windowMemory 1024m</code></li>
  <li>$ git count-objects -v
  count: 9
  size: 48
  in-pack: 4504
  packs: 1
  size-pack: 106822
  prune-packable: 0
  garbage: 0</li>
  </ol>
  <p>No luck there, not sure what actions should i take next...<br />
  The size of the repo should be around 10-20m  of code. what actions should i take next?</p>
  <p><strong>UPDATE 1</strong><br />
  i executed these commands:</p>
  <pre><code>$ git filter-branch --index-filter 'git rm --cached --ignore-unmatch public/images/*' HEAD
  Rewrite a1c9fb8324a2d261aa745fc176ce2846d7a2bfd7 (288/288)
  WARNING: Ref 'refs/heads/master' is unchanged
  </code></pre>
  <p>and</p>
  <pre><code>$ git push --force --all
  Counting objects: 4513, done.
  Compressing objects: 100% (1614/1614), done.
  Writing objects: 100% (4513/4513), 104.20 MiB | 451 KiB/s, done.
  Total 4513 (delta 2678), reused 4500 (delta 2671)
  remote: bb/acl: ayermolenko is allowed. accepted payload.
  To https://repo@bitbucket.org/repo.git
   + 203e824...ed003ce demo -&gt; demo (forced update)
   + d59fd1b...a1c9fb8 master -&gt; master (forced update)
  </code></pre>
  <p>Pull then works ok:</p>
  <pre><code>$ git pull
  Already up-to-date.
  </code></pre>
  <p>But when I try to clone repo I get</p>
  <pre><code>~/www/clone$ git clone git@bitbucket.org:repo.git
  Cloning into 'clone'...
  remote: Counting objects: 5319, done.
  remote: Compressing objects: 100% (1971/1971), done.
  fatal: Out of memory, malloc failed (tried to allocate 4266852665 bytes)
  fatal: index-pack failed
  </code></pre>
  <p><strong>UPDATE 2</strong><br />
  Sadly enough I didn't find all of the large files. Some are still left. So I asked support to kill all the logs of the repo</p>
  <p><strong>UPDATE 3</strong><br />
  In the end I had to kill old &amp; create a new repo.</p>