我在https://bitbucket.org/上有一个代码仓库。
几天前,由于一个错误,大量图像文件被推送到代码仓库中。然后再通过另一次推送删除了这些文件。之后,代码仓库一直工作正常,但今天当我尝试从代码仓库拉取时:
$ git pull
Password for 'https://repo@bitbucket.org':
warning: no common commits
remote: Counting objects: 4635, done.
remote: Compressing objects: 100% (1710/1710), done.
fatal: Out of memory, malloc failed (tried to allocate 4266852665 bytes)
fatal: index-pack failed
我尝试过:
git config --global pack.windowMemory 1024m
- $ git count-objects -v count: 9 size: 48 in-pack: 4504 packs: 1 size-pack: 106822 prune-packable: 0 garbage: 0
但是没有成功,我不确定接下来该采取什么措施...
代码库的大小应该在10-20m左右,我该怎么做?
更新1
我执行了这些命令:
$ git filter-branch --index-filter 'git rm --cached --ignore-unmatch public/images/*' HEAD
Rewrite a1c9fb8324a2d261aa745fc176ce2846d7a2bfd7 (288/288)
WARNING: Ref 'refs/heads/master' is unchanged
和
$ git push --force --all
Counting objects: 4513, done.
Compressing objects: 100% (1614/1614), done.
Writing objects: 100% (4513/4513), 104.20 MiB | 451 KiB/s, done.
Total 4513 (delta 2678), reused 4500 (delta 2671)
remote: bb/acl: ayermolenko is allowed. accepted payload.
To https://repo@bitbucket.org/repo.git
+ 203e824...ed003ce demo -> demo (forced update)
+ d59fd1b...a1c9fb8 master -> master (forced update)
拉动后正常工作:
$ git pull
Already up-to-date.
但是当我尝试克隆代码库时,我遇到了以下问题
~/www/clone$ git clone git@bitbucket.org:repo.git
Cloning into 'clone'...
remote: Counting objects: 5319, done.
remote: Compressing objects: 100% (1971/1971), done.
fatal: Out of memory, malloc failed (tried to allocate 4266852665 bytes)
fatal: index-pack failed
更新2
非常遗憾,我没有找到所有的大文件。还有一些留下了。所以我请求支持团队删除这个仓库的所有日志。
更新3
最终我不得不删除旧的并创建一个新的仓库。