可以“git fetch”吗?被告知不要使用“git upload-pack”对于本地存储库?
当使用 git fetch 来将引用从一个(非常大的)存储库获取到本地计算机上的另一个存储库时,git upload-pack 需要很长时间才能创建包文件。在本地情况下,不需要最大限度地减少传输的数据量,并且我不关心因丢失增量压缩而损失的磁盘空间,因此理想情况下,我更喜欢复制丢失的对象而不是打包然后进口的。有没有办法告诉 git fetch 在使用本地传输时只复制丢失的对象?
或者,更一般地说,有没有办法在全局范围内抑制包文件的生成?实际上,我只是想使用 git 作为版本控制的文件系统,它不会为相同的文件占用额外的空间 - 打包和重新打包似乎是一个耗时的步骤,这使得这很尴尬。
顺便说一句,我花了一些时间尝试优化配置选项,以便重新打包不会花费那么长时间(也不会开始颠簸),所以我不认为答案是“使用这些配置选项,打包会发生得更快” - 但是,也许我都错了,所以为了清楚起见,我通常使用的配置选项(在具有 2 GiB RAM 的机器上)是:
core.deltacachesize=1
core.packedgitwindowsize=16m
core.packedgitlimit=128m
pack.packsizelimit=512m
pack.windowmemory=200m
pack.deltacachesize=200m
pack.window=4
pack.compression=3
pack.threads=0
gc.auto=0
gc.pruneexpire=never
receive.autogc=false
When using git fetch
to fetch refs from one (very large) repository to another one on the local machine, git upload-pack
takes a very long time to create pack files. In the local case there's not such a need to minimize the amount of data transported, and I don't care about disk space lost by losing delta compression, so ideally I'd prefer for the missing objects to be copied rather than packed and then imported. Is there any way to tell git fetch
to just copy the missing objects when using the local transport?
Or, more generally, is there a way to suppress the generation of pack files globally? Really I just want to use git as a versioned filesystem that doesn't use up extra space for identical files - packing and repacking seems to be the time-consuming step that makes this awkward.
Incidentally, I've spent some time trying to optimize config options so that repacking doesn't take so long (nor start thrashing) so I don't think the answer is "use these config options and packing will happen much faster" - however, perhaps I've got that all wrong, so just to be clear, the config options that I'm typically using (on a maching with 2 GiB of RAM) are:
core.deltacachesize=1
core.packedgitwindowsize=16m
core.packedgitlimit=128m
pack.packsizelimit=512m
pack.windowmemory=200m
pack.deltacachesize=200m
pack.window=4
pack.compression=3
pack.threads=0
gc.auto=0
gc.pruneexpire=never
receive.autogc=false
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
也许您可以使用替代(替代对象存储)机制;这将允许与其他本地存储库共享对象数据库,然后不必打包它们。
要进行设置,请使用 'git clone'存储库,但是当您本地有类似的存储库时,或者只是编辑
.git/objects/info/alternates
文件。Perhaps you could use alternates (alternate object storage) mechanism; this would allow sharing object database with other local repository, and then not having to pack them.
To set up this, use 'git clone' using either
--shared
option if cloning from local repository, or--reference <repository>
if cloning from remote repository but when you have similar repository locally, or just edit.git/objects/info/alternates
file.我有一个普通的旧
git clone
不会克隆的存储库:虽然它被它覆盖的进度文本隐藏,但失败的错误消息是
error: pack-objects dead of signal 9
代码>.我可以通过在客户端禁用打包来防止该错误。我通过发出一系列命令(与 git 1.7.4.1 一起发出)来完成此操作,这些命令基本上执行 git clone 的操作,但使用一个额外的命令将 pack.depth 设置为
0
在运行git fetch
之前。I have a repository that plain old
git clone
will not clone:Although it's concealed by the progress text which it overwrite, the failing error message is
error: pack-objects died of signal 9
.I was able to prevent the error by disabling packing on the client side. I did this by issuing a sequence of commands (issued with git 1.7.4.1) that basically do what
git clone
does, but with an extra command to setpack.depth
to0
before runninggit fetch
.也许(未经测试)设置
http-backend
用于您的第一个存储库(您从中获取的存储库)。这种服务器有一个您可能感兴趣的设置:
Maybe (not tested) setting up a
http-backend
for your first repo (the one from which you are fetching).This kind of server has a setting which could be of interest in your case: