对于不再存在的大文件的Git错误

时间:2018-03-10 16:24:44

标签: git

我的github项目似乎停留在我的操作系统上不再存在的大文件中,因为它一直失败,我无法推送我的提交。

当我尝试将我的提交推送到github上的master分支时,我收到此错误:

remote: Resolving deltas: 100% (1180/1180), completed with 13 local objects.
remote: error: GH001: Large files detected. You may want to try Git 
Large File Storage - https://git-lfs.github.com.
remote: error: Trace: e96e4de4bdf59aff52d77d7d2dde1b25
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File wheel/vendor/browscap/config/browscap.csv is 128.44 MB; this exceeds GitHub's file size limit of 100.00 MB

问题是该文件不在目录中。

I even installed the git large file support but its not tracking the file since its not on my computer

我尝试使用以下命令重新加载文件:

root@yonaton-Lenovo-V570:/var/www/html/ssa# git checkout wheel/vendor/browscap/config/browscap.csv

root@yonaton-Lenovo-V570:/var/www/html/ssa# git reset wheel/vendor/browscap/config/browscap.csv

此时我不知道该怎么做。

root@yonaton-Lenovo-V570:/var/www/html/ssa# git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch wheel/vendor/browscap/config/browscap.csv" HEAD
Cannot rewrite branches: You have unstaged changes.
Additionally, your index contains uncommitted changes.

root@yonaton-Lenovo-V570:/var/www/html/ssa# git filter-branch --tree-filter "rm -rf wheel/vendor/browscap/config/browscap.csv" HEAD
Cannot rewrite branches: You have unstaged changes.
Additionally, your index contains uncommitted changes.

1 个答案:

答案 0 :(得分:0)

我遇到了类似的问题,事实证明,运行push命令后,解决git中大文件问题的最佳方法是使用git lfs migrate命令:

git lfs migrate import --include="*.csv"

我找到了解决方法here。对于我来说,大文件的文件类型为.zip,下面的命令对我来说非常有用。

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