1
remote: error: GH001: Large files detected. You may want to try Git Large File Storage

I deleted the file. Below, you can see me trying to push, then trying to remove the file from the cache.

enter image description here

How do I get rid of this large file so I can push again?

User
  • 23,729
  • 38
  • 124
  • 207
  • Now I understand [your comment on my answer over here](https://stackoverflow.com/questions/33466466/git-still-trying-to-push-ignored-and-deleted-file/33466589?noredirect=1#comment60444638_33466589). – Schwern Apr 05 '16 at 01:11
  • Potential duplicate of http://stackoverflow.com/q/34175916/1256452 – torek Apr 05 '16 at 01:42

3 Answers3

4

I ended up doing a work around.

  1. Backup all my files to another folder: cp . ../backup
  2. Remove .git from the backup: rm -R ..backup/.git
  3. Find the latest good commit on the server and restore to it: git reset --hard c14809fa
  4. Copy all old files back: cp ../backup .

Then just go ahead and commit and push.

User
  • 23,729
  • 38
  • 124
  • 207
  • 1
    While this works, it loses all history between when the large file was added and the latest commit. – Schwern Apr 05 '16 at 01:15
  • This worked for me too. In my case I just took backup of the recent files I changed and deleted the local repo and then checked out the code from repo and replaced the latest files from my local back up and then committed. This worked & is also easier. – Krish Feb 04 '17 at 05:54
2

The file must not just be deleted, it must be removed from history. This is the same procedure you'd follow to remote a sensitive file, such as a password file.

There's a number of ways to do this, the simplest is to follow the instructions on Github. They show two ways to scrub the file from all commits it is present in.

Schwern
  • 153,029
  • 25
  • 195
  • 336
0

One good solution that worked for me:

git filter-branch --tree-filter 'rm path/to/your/bigfile' HEAD

and then:

git push origin master --force
Mahmoud Abdelsattar
  • 1,299
  • 1
  • 15
  • 31