我在树莓派上使用私人托管的 git 存储库来存储我所有的学校作业。我这样做是为了帮助我熟悉 Git,并在一般情况下运行 linux 服务器。一切正常,直到昨晚我收到一条错误消息,内容如下:
remote: Counting objects: 2688, done.
remote: Compressing objects: 100% (1784/1784), done.
remote: fatal: Out of memory, malloc failed (tried to allocate 243315665 bytes)
error: git upload-pack: git-pack-objects died with error.rRemote: aborting due t
fatal: git upload-pack: aborting due to possible repository corruption on the re
mote side.ly EOF: 72% (1937/2688), 42.41 MiB | 293.00 KiB/s
fatal: index-pack failed
我假设这里的实际问题是服务器只是内存不足。我检查了我的 repo 的大小,它超过了 300mb。这是因为作为一个新用户,我没有意识到上传诸如 Visual Studio、Eclipse 和 Netbeans 临时用户文件之类的东西是一件坏事。我知道如何为当前和未来的提交删除这些文件 - 但我一直很难尝试从存储库中完全删除这些文件。谷歌帮助我挖掘的所有过滤器分支方法似乎只适用于几个文件。我需要批量删除许多文件,并且当它在给定目录中找不到单个文件时,我需要它不要抱怨我。
所以我的问题是,有没有一种合理的方法来做我所要求的?或者在我的情况下,只是丢失我的提交消息历史记录,并从第一天开始安全地启动所有 .gitignore 文件的新存储库会更容易吗?