git pull 无需远程压缩对象

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7102053/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 11:36:49  来源:igfitidea点击:

git pull without remotely compressing objects

git

提问by hdorio

I have a repository full of zip files, re-compressing theses files will be a waste of time.

我有一个装满 zip 文件的存储库,重新压缩这些文件会浪费时间。

I've tried to set core.compression = 0on the remote and the local copy without success

我试图在远程和本地副本上设置core.compression = 0没有成功

git config core.compression 0
git config core.loosecompression 0

git pullstill do

git pull仍然可以

remote: Counting objects: 23, done.
remote: Compressing objects: ...

回答by hdorio

The time problem I had was caused by delta compression.

我遇到的时间问题是由增量压缩引起的。

The solution for me was

我的解决方案是

echo '*.zip -delta' > .gitattributes
git gc

I will quote this excellent response from http://lists-archives.com/git/719515-serious-performance-issues-with-images-audio-files-and-other-non-code-data.html

我将引用来自http://lists-archives.com/git/719515-serious-performance-issues-with-images-audio-files-and-other-non-code-data.html 的出色回复

Git does spend a fair bit of time in zlib for some workloads, but it should not create problems on the order of minutes.

For pushing and pulling, you're probably seeing delta compression, which can be slow for large files

core.compression 0 # Didn't seem to work.

That should disable zlib compression of loose objects and objects within packfiles. It can save a little time for objects which won't compress, but you will lose the size benefits for any text files.

But it won't turn off delta compression, which is what the "compressing..." phase during push and pull is doing. And which is much more likely the cause of slowness.

pack.window 0

It sets the number of other objects git will consider when doing delta compression. Setting it low should improve your push/pull times. But you will lose the substantial benefit of delta-compression of your non-image files (and git's meta objects). So the "-delta" option above for specific files is a much better solution.

echo '*.jpg -delta' > .gitattributes

Also, consider repacking your repository, which will generate a packfile that will be re-used during push and pull.

对于某些工作负载,Git 确实在 zlib 中花费了相当多的时间,但它不应该在几分钟内产生问题。

对于推和拉,您可能会看到增量压缩,这对于大文件来说可能很慢

core.compression 0 # 似乎不起作用。

这应该禁用对松散对象和包文件中的对象的 zlib 压缩。它可以为不会压缩的对象节省一点时间,但您将失去任何文本文件的大小优势。

但它不会关闭增量压缩,这就是推和拉过程中的“压缩...”阶段正在做的事情。这更有可能是导致缓慢的原因。

包.window 0

它设置 git 在进行增量压缩时将考虑的其他对象的数量。将其设置得较低应该可以改善您的推/拉时间。但是您将失去对非图像文件(和 git 的元对象)进行增量压缩的实质性好处。因此,上面针对特定文件的“-delta”选项是一个更好的解决方案。

echo '*.jpg -delta' > .gitattributes

此外,请考虑重新打包您的存储库,这将生成一个打包文件,该文件将在推和拉过程中重复使用。

Note that the settings have to be made on the repo you are fetching/pulling from, not the one you are fetching/pulling to.

请注意,必须在您正在获取/拉取的存储库上进行设置,而不是您要获取/拉取的存储库。

回答by J-16 SDiZ

The compressing objectline means it is do the packing work. That include diffing the trees and stuff. It is not "compressing" in the sense of core.compression.

compressing object条线意味着它正在做packing 工作。这包括区分树木和其他东西。它不是“压缩”意义上的core.compression