如何在运行BFG Repo Cleaner后更新/缩小我的github repo的大小 [英] How to update/shrink the size of my github repo after running BFG Repo Cleaner

查看:288
本文介绍了如何在运行BFG Repo Cleaner后更新/缩小我的github repo的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下 BFG Repo Cleaner 的回购清单。 /rtyley.github.io/bfg-repo-cleaner/#usage\">程序:

  $ git clone --mirror git://example.com/some-big-repo.git 
$ java -jar bfg.jar --strip-largest-blobs 500 some-big-repo.git
$ cd some-big-repo.git
$ git reflog expire --expire = now --all
$ git gc --prune = now --aggressive
$ git push

我可以看到我的本地回购已经缩小为1GB。大。我现在遇到的问题以及我无法找到任何信息的原因是,现在我也想缩小GitHub-repo的大小。如何实现这一目标?



git push 不起作用,我也试过 git push origin --force --all 给了我这个错误信息: error:--all和--mirror不兼容

解决方案

我的建议:不要太担心GitHub报告的回购大小。由于各种原因,它不能准确反映回购的真实规模。



您真正关心的是对此的回答问题:

如果我在GitHub上做了一个新的克隆,我的磁盘上的这个回购有多大?



您需要下载的数据量才能完全克隆您的repo,以及它在磁盘上占用的空间量,这是您真正关心的事情(以及几乎相同的数量)。尝试做一个新的克隆,看看有多少数据被传输,它占用了多少空间。它应该与您缩小的回购的大小相匹配。



在GitHub控制台中报告的数量(即在 https://github.com/settings/repositories ,或者在GitHub API中)对你来说并不重要,这很幸运,因为它享有解放和有点醉意由于使用了 Git Alternates git gc 仅在GitHub服务器上定期发生。

边注:Bitbucket也可以花时间来更新报告的回购规模。 在您的回购站点上,并不意味着GitHub已在他们的回购副本将会显得更大一段时间,即使你克隆它时,只会发送'基本'信息,所以你会收到你想要的更小的回购。

完全披露:我是BFG Repo-Cleaner的作者。

I have cleaned my repo with BFG Repo Cleaner using the following procedure:

$ git clone --mirror git://example.com/some-big-repo.git
$ java -jar bfg.jar --strip-biggest-blobs 500 some-big-repo.git
$ cd some-big-repo.git
$ git reflog expire --expire=now --all
$ git gc --prune=now --aggressive
$ git push

I can see that my local repo has shrunk with 1GB. Great. The problem that I'm having now and that I haven't been able to find any info on is that now I would like to also shrink the size of the GitHub-repo as well. How to achieve this?

git push didn't work and I also tried git push origin --force --all which gave me this error message: error: --all and --mirror are incompatible

解决方案

My advice: don't worry too much about what GitHub reports as the repo size. For various reasons it won't accurately reflect the 'true' size of the repo.

What you really care about is the answer to this question:

How big is this repo on my disk if I do a fresh clone of it from GitHub?

The amount of data you have to download to do a fresh clone of your repo, and the amount of space it takes up on your disk, are the things you really care about (and nearly identical quantities). Try doing a fresh clone and seeing how much data gets transferred and how much room it takes up on your disk. It should match the size of your shrunken repo.

The number reported in the GitHub console (ie at https://github.com/settings/repositories, or in the GitHub API) is not really important to you, which is fortunate, because it enjoys a liberated and somewhat drunken relationship with the more important figure above, due to the use of Git Alternates, and git gc occurring only periodically on GitHub servers.

Side note: Bitbucket can also take time to update reported repo size.

Just because you ran git gc locally on your repo, doesn't mean GitHub have run it on their copy of your repo yet, and so their copy of your repo will appear much bigger for a while, even though when you clone it, only the 'essential' information is sent, and so you receive the smaller repo that you desire.

Full disclosure: I'm the author of the BFG Repo-Cleaner.

这篇关于如何在运行BFG Repo Cleaner后更新/缩小我的github repo的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆