git push 致命:无法创建线程:资源暂时不可用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9905257/
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
git push fatal: unable to create thread: Resource temporarily unavailable
提问by Yuan Chen
I'm new to git. I'm want to push a large commit to a remote server but the problem is when I use
我是 git 新手。我想将大量提交推送到远程服务器,但问题是当我使用
git push origin master
it return the error
它返回错误
Counting objects: 5009, done.
Delta compression using up to 16 threads.
fatal: unable to create thread: Resource temporarily unavailable
error: pack-objects died with strange error
So is there anyway I can set the max thread use for Delta Compression.
所以无论如何我可以为Delta Compression设置最大线程使用。
Thanks for help,
感谢帮助,
Yuan Chen
陈元
回答by Waqar
The error: "fatal: unable to create thread: Resource temporarily unavailable" strongly suggests you've run out of memory on the server, which can happen if you have a repository with lots of large files, which can cause re-packing to take a lot of memory, or limited virtual memory - either in general, or just for that account due to the ulimit setting.
错误:“致命:无法创建线程:资源暂时不可用”强烈表明您的服务器内存不足,如果您的存储库包含大量大文件,则可能会发生这种情况,这可能会导致重新打包大量内存,或有限的虚拟内存 - 通常情况下,或由于 ulimit 设置而仅用于该帐户。
Anyways, here's the commands you can run to limit the amount of memory that packing may take by logging into the remote system (as the user that git runs as) and typing these commands:
无论如何,这里是您可以运行的命令,通过登录远程系统(作为 git 运行的用户)并键入以下命令来限制打包可能占用的内存量:
git config --global pack.windowMemory "100m"
git config --global pack.packSizeLimit "100m"
git config --global pack.threads "1"
Hope this works.
希望这有效。
回答by Nguyen Kien
I've also stumbled upon this error. To make it simpler, this error occurs because you want to copy a 100mb file into a hdd with free space of 50mb (or less). To fix this, SSH into the server and run the following commands:
我也偶然发现了这个错误。为简单起见,发生此错误是因为您要将 100mb 的文件复制到可用空间为 50mb(或更少)的硬盘中。要解决此问题,请通过 SSH 连接到服务器并运行以下命令:
git config --global pack.windowMemory "100m"
git config --global pack.packSizeLimit "100m"
回答by Muzaffar Mahmood
In shared hosting we have limited cpu resources mostly 1 cpu so multi-threading does not work very well there. This error is due to limited cpu resource actually.
在共享主机中,我们的 cpu 资源有限,主要是 1 个 cpu,因此多线程在那里不能很好地工作。这个错误实际上是由于有限的 CPU 资源。
Just this one git setting is enough to resolve this.
仅此一个 git 设置就足以解决此问题。
git config --global pack.threads "1"
This is limiting git to create only one thread.
这限制了 git 只能创建一个线程。
回答by VonC
"unable to create thread: Resource temporarily unavailable
" means an issue with the remote server (like no more memory available).
" unable to create thread: Resource temporarily unavailable
" 表示远程服务器的问题(例如没有更多可用内存)。
Regarding delta, you have the following configto tweak:
关于增量,您可以调整以下配置:
pack.deltaCacheSize
The maximum memory in bytes used for caching deltas in git-pack-objects(1) before writing them out to a pack.
This cache is used to speed up the writing object phase by not having to recompute the final delta result once the best match for all objects is found.
Repacking large repositories on machines which are tight with memory might be badly impacted by this though, especially if this cache pushes the system into swapping.
A value of 0 means no limit.
The smallest size of 1 byte may be used to virtually disable this cache. Defaults to 256 MiB.
在将 git-pack-objects(1) 中的增量写入包之前,用于缓存增量的最大内存(以字节为单位)。
该缓存用于在找到所有对象的最佳匹配后无需重新计算最终增量结果来加速写入对象阶段。
但是,在内存紧张的机器上重新打包大型存储库可能会受到严重影响,尤其是如果此缓存将系统推入交换状态。
值 0 表示没有限制。
1 字节的最小大小可用于虚拟禁用此缓存。默认为 256 MiB。
pack.deltaCacheLimit
The maximum size of a delta, that is cached in git-pack-objects(1).
This cache is used to speed up the writing object phase by not having to recompute the final delta result once the best match for all objects is found. Defaults to 1000.
delta 的最大大小,缓存在 git-pack-objects(1) 中。
该缓存用于在找到所有对象的最佳匹配后无需重新计算最终增量结果来加速写入对象阶段。默认为 1000。
The SO question "Git pull fails with bad pack header error" references other pack
-related configs.
SO 问题“ Git pull failed with bad pack header error”引用了其他pack
相关的配置。