我最近安装了 Git-LFS管理大文件。然而,我很快就达到了 1 Gb 的存储限制,现在当我尝试推送提交时,系统提示我:
batch response: This repository is over its data quota. Purchase more data packs to restore access.
和推送失败。所以现在我实际上无法推送到 repo 协议(protocol)。
购买更多数据包不是一种选择,但是在本地存储大文件(即不对它们进行版本控制)是一种选择。
所以我想做的是:
- 停止监控 LFS 监控的文件(目前在 .gitattributes 中设置为所有 *.csv)。
- 从 git 中删除这些文件,即它们不会影响任何存储库大小。
- 这些文件仍然存在于本地。
- 卸载 Git-LFS。
- 尽可能少地破坏历史记录,理想情况下只有删除的文件会受到影响。
- 现在 repo 大小应该更小了,回到能够正常推/pull 的状态。
我发现了关于人们超出限制的点点滴滴的信息,但没有什么可以解决上述问题。
FWIW 我通常使用 Tortoise Git,但当然也有 Git Shell。
最佳答案
Is there a way to rewrite history such that it omits the csv files but otherwise is the same?
这就是git filter-branch
是为了。同样,它将重写历史,因此需要 git push --force
。
另见“Git - Remove All of a Certain Type of File from the Index”:BFG repo cleaner可以更容易/更快地使用。
关于git - 超过限制后撤消 git lfs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49375105/