无法推送大文件

Failing to push large files

在将文件推送到 GitHub 时,我没有注意到它有多大以及推送它的时间

$ 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 'git@github.com:tiago-peres/Repo.git'

根据 this answer,我想使用 Git 大文件存储 (LFS) 然后上传它。

因此,使用 Git Bash,安装它并使其跟踪 .zip 文件。

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

之后,如果我尝试推动,我无法推动。

$ 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 'git@github.com:tiago-peres/Repo.git'

为了修复它,我运行

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

然后就可以顺利推送了