清洁后如何降低Bitbucket存储库中的尺寸
我有一个Bitbucket中的存储库,使用了约160MB,我删除了所有分支。回购很清楚,它继续说我使用了160 MB。
我如何真正删除存储库中的所有文件。我不想创建一个新的回购。
作为敬拜。如果我在存储库中添加了一些文件,例如“ file.mp3”,然后将其删除,它会增加回购大小,而我无法再次减少它。我尝试了一些帖子,例如这个atlassian help 。
最好,
编辑:我试图使用BFG。当我制作“ BFG-Strip-Blobs-bigger-比1M”时,我得到了:
Scanning packfile for large blobs: 115
Scanning packfile for large blobs completed in 16 ms.
Found 6 blob ids for large blobs - biggest=47522424 smallest=1515614
Total size (unpacked)=102234236
Found 2 objects to protect
Found 4 commit-pointing refs : HEAD, refs/heads/11.0.0-7, refs/heads/master, refs/notes/master
Protected commits
-----------------
These are your protected commits, and so their contents will NOT be altered:
* commit 57632224 (protected by 'HEAD')
Cleaning
--------
Found 3 commits
Cleaning commits: 100% (3/3)
Cleaning commits completed in 166 ms.
Updating 1 Ref
--------------
Ref Before After
-----------------------------------------
refs/heads/11.0.0-7 | b333507a | 37b0f5cb
Updating references: 100% (1/1)
...Ref update completed in 16 ms.
Commit Tree-Dirt History
------------------------
Earliest Latest
| |
. D .
D = dirty commits (file tree fixed)
m = modified commits (commit message or parents changed)
. = clean commits (no changes to file tree)
Before After
-------------------------------------------
First modified commit | b333507a | 37b0f5cb
Last dirty commit | b333507a | 37b0f5cb
Deleted files
-------------
Filename Git id
-----------------------------------------------------------
Image.png | 6481d63a (3,3 MB)
Sfile3.rpm | e8b6f2b8 (29,4 MB)
UserManual.pdf | 77c29187 (16,2 MB)
c.res | 92392c06 (1,4 MB)
xxxx.png | 6481d63a (3,3 MB)
file1 | f24d869b (45,3 MB)
file2 | 4e62ab09 (1,9 MB)
In total, 9 object ids were changed.
I have a repository in Bitbucket that has ~160MB used, I deleted all branches. The repo is totally clear it continues saying that i have 160 MB used.
How can i real delete all the files in my repo. I dont want to create a new repo.
As adittion. If i add some files , for example "file.mp3" to the repo, then i delete it, it increase the Repo Size and i cannot reduce it again. I tried some post like this Atlassian Help.
Best,
EDIT: Im trying to use BFG. When i made a "bfg --strip-blobs-bigger-than 1M" i got:
Scanning packfile for large blobs: 115
Scanning packfile for large blobs completed in 16 ms.
Found 6 blob ids for large blobs - biggest=47522424 smallest=1515614
Total size (unpacked)=102234236
Found 2 objects to protect
Found 4 commit-pointing refs : HEAD, refs/heads/11.0.0-7, refs/heads/master, refs/notes/master
Protected commits
-----------------
These are your protected commits, and so their contents will NOT be altered:
* commit 57632224 (protected by 'HEAD')
Cleaning
--------
Found 3 commits
Cleaning commits: 100% (3/3)
Cleaning commits completed in 166 ms.
Updating 1 Ref
--------------
Ref Before After
-----------------------------------------
refs/heads/11.0.0-7 | b333507a | 37b0f5cb
Updating references: 100% (1/1)
...Ref update completed in 16 ms.
Commit Tree-Dirt History
------------------------
Earliest Latest
| |
. D .
D = dirty commits (file tree fixed)
m = modified commits (commit message or parents changed)
. = clean commits (no changes to file tree)
Before After
-------------------------------------------
First modified commit | b333507a | 37b0f5cb
Last dirty commit | b333507a | 37b0f5cb
Deleted files
-------------
Filename Git id
-----------------------------------------------------------
Image.png | 6481d63a (3,3 MB)
Sfile3.rpm | e8b6f2b8 (29,4 MB)
UserManual.pdf | 77c29187 (16,2 MB)
c.res | 92392c06 (1,4 MB)
xxxx.png | 6481d63a (3,3 MB)
file1 | f24d869b (45,3 MB)
file2 | 4e62ab09 (1,9 MB)
In total, 9 object ids were changed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题是git商店永远存在,因此您必须更努力地删除东西。通过删除分支,您实际上只是在删除存储在存储库中的补丁的引用。
我建议您尝试使用 bfg 。它非常快,非常简单。
这些设置将需要更改以适合您需要,但这实际上将重写存储库中斑点的内容。
验证
以验证这些步骤,我做了以下操作:
此时,我没有发现大斑点。如果在那里,它将被剥离。因此,我检查了回购镜的大小。 88 kb;与bitbucket.org报告的1.12 MB相反。事实证明,Bitbucket确实修剪了文件,并且存储库实际上较小,它们的界面只是谎言和报告,包括悬空文件,这些文件将在以后清理。
最重要的是,如果您的克隆较小,则不要相信存储库设置中的信息。
The thing is git stores hashes perpetually, so you have to work a bit harder to remove stuff. By deleting branches, you're really just deleting references to patches stored in the repository.
I recommend you try using bfg. It is very fast and very simple to use.
These settings will need to change to suit you needs, but this will actually rewrite the contents of the blobs in the repository.
Verification
To verify these steps, I did the following:
At this point, I found no large blobs. If it were there, it would have been stripped. So I checked the size of the repo mirror. 88 KB; as opposed to 1.12 MB reported by bitbucket.org. Turns out, bitbucket did prune the file and the repository actually is smaller, their interface just lies and reports usage including dangling files that will be cleaned up at a later date.
Bottom line, if your clone is smaller, then don't trust the information in your repository settings.
将对象添加到对象数据库中后,如果对象没有当前的分支/tag ,则它将至少持续一段时间。即使该对象没有用分支/标签指向,但倒流仍然可以将其保存一段时间,这可能需要一点时间才能清除修订。 git每隔一段时间会进行垃圾收集...您可以强迫使用
git gc
运行它。检查其选项并玩得开心。Once you add the object to the object DB, it will stay there for at least a while if the object is not pointed by something like a current branch/tag. Even if the object is not pointed by a branch/tag, it can still be held for a while by the reflog which can take a little bit to allow a revision to be cleared up. Git does garbage-collection every so often... and you can force to run it with
git gc
. Check its options and have fun with it.