从git暂存区中删除大文件

问题描述 投票:0回答:1

我已尝试推送包含超过100 MB限制的文件的提交并查看消息

remote: error: File data/clean/new/all_listings_clean.csv is 327.92 MB; this exceeds GitHub's file size limit of 100.00 MB

所以我在本地删除了文件(不需要它),尝试了git reset,然后尝试了git add -A + git commit -m "..."git push origin master,但是我看到了相同的错误消息。

我也尝试过git reset HEAD^git reset HEAD -- .git reset HEAD~git rm --cached

我一直收到此错误!它无法弄清楚如何告诉它刷新我的暂存区域,不能识别大文件了,然后继续推进没有它的提交。

bash git terminal git-push git-reset
1个回答
0
投票

您应使用此工具:

https://rtyley.github.io/bfg-repo-cleaner/

这是完成此类任务的理想工具

BFG回购清洁器

git-filter-branch的替代。

BFG是git-filter-branch的一种更简单,更快的替代方法,用于从Git存储库历史记录中清除坏数据

  • 删除疯狂的大文件
  • 删除密码,凭据和其他私人数据

示例(来自官方网站)

在所有这些示例中,bfg是java -jar bfg.jar的别名。

# Delete all files named 'id_rsa' or 'id_dsa' :
bfg --delete-files id_{dsa,rsa}  my-repo.git
© www.soinside.com 2019 - 2024. All rights reserved.