无法推送大文件

时间:2020-05-11 11:15:16

标签: git github git-bash 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'

1 个答案:

答案 0 :(得分:0)

为了修复它,我跑了

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

然后能够毫无问题地推动它。