Search code examples
gitgithubgit-bashlarge-files

Failing to push large files


While pushing a file into GitHub, I didn't notice how big it was and when pushing it

$ git push
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 130.71 MiB | 2.14 MiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: bc61935b67985b3472b6cfd75f5024ec
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File name.zip is 130.67 MB; this exceeds GitHub's file size limit of 100.00 MB
To github.com:tiago-peres/Repo.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:tiago-peres/Repo.git'

As based in this answer, I wanted to use Git Large File Storage (LFS) then to upload it.

So, using Git Bash, installed it and made it track .zip files.

$ git lfs install
$ git lfs track "*.zip"

After, if i try to push, I'm not able to.

$ git push
Uploading LFS objects: 100% (2/2), 274 MB | 0 B/s, done
Enumerating objects: 10, done.
Counting objects: 100% (10/10), done.
Delta compression using up to 4 threads
Compressing objects: 100% (8/8), done.
Writing objects: 100% (9/9), 130.71 MiB | 1.86 MiB/s, done.
Total 9 (delta 0), reused 0 (delta 0)
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 2cf79d65722b6e4d2e1f8136601c9c5e
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File name.zip is 130.67 MB; this exceeds GitHub's file size limit of 100.00 MB
To github.com:tiago-peres/Repo.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:tiago-peres/Repo.git'

Solution

  • In order to fix it, I ran

    $ git lfs migrate import --include="*.zip"
    

    And then was able to push it without any problems.