2012-03-28 144 views
24

我是新来的git。 我要推一个大承诺到远程服务器,但问题是 当我使用git push致命:无法创建线程:资源暂时不可用

git push origin master 

它返回错误

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 

所以有反正我可以设置最大线程用于Delta压缩。

感谢您的帮助,

元辰

+0

命令可以运行,以限制的存储器,其包装可采取通过登录到远程系统 'GIT中配置--global pack.windowMemory“百米”' 'GIT中配置--global pack.packSizeLimit“量100m“' 'git config --global pack.threads”1“' – Adnan 2018-02-09 21:46:59

回答

2

unable to create thread: Resource temporarily unavailable”是指与远程服务器(如没有可用的内存)的问题。

关于三角洲,您有以下config来调整:

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.

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.

的SO问题 “Git pull fails with bad pack header error” 引用其他pack - 相关CONFIGS。

2

我也偶然发现了这个错误。为了简化起见,发生此错误是因为您想要将100MB文件复制到具有50MB(或更少)可用空间的硬盘中。为了解决这个问题,SSH到服务器并运行以下命令:

git config --global pack.windowMemory "100m" 
git config --global pack.packSizeLimit "100m" 
+2

它应该是'pack.packSizeLimit'而不是'pack.SizeLimit'。 – yig 2015-07-08 19:13:23

75

的错误:“致命的:无法创建线程:资源暂时不可用”强烈建议你在服务器上运行内存不足这如果您的存储库中存在大量大文件,可能会导致重新打包占用大量内存或限制虚拟内存 - 无论是通常还是仅限于该帐户,这都会由于ulimit设置而发生。

不管怎么说,这里的命令,你可以运行限制的内存包装可通过登录到远程系统采取(作为git的形式运行的用户)的金额,然后输入以下命令:

git config --global pack.windowMemory "100m" 
git config --global pack.packSizeLimit "100m" 
git config --global pack.threads "1" 

希望这工作。

+15

许多共享托管解决方案都会专门限制线程。通常在这个答案中最后一条命令将其降低到<10以解决问题。 – Qix 2014-03-24 18:49:49

+1

我在共享主机上尝试将'git push'设置为远程时出现此问题。设置'pack.threads“10”'为我修好了。在尝试运行'git gc'时,我遇到了类似的问题,当它进入重新打包阶段时。同样的修复。干杯。 – 2015-03-11 02:42:22

+1

如果您的服务器使用智能http协议,则可能无法为该过程设置全局配置。相反,将'cd'放入git存储库本身的目录中并运行相同的命令,而不用'--global'。 – yig 2015-07-08 19:09:49

相关问题