git push提示remote: fatal: Out of memory, malloc failed解决方法

编程基础 git  收藏
0 / 277

git服务器内存1G,代码仓库超过1G,导致git push 提示remote: fatal: Out of memory, malloc failed,只需要给服务器增加下swap空间即可:

1.添加交换文件

mkdir -p /opt/temp

dd if=/dev/zero of=/opt/temp/swap bs=1024 count=4096000

目录路径和大小自己看着办就好了)

2.创建交换空间

mkswap /opt/temp/swap

3.启动新增加的4G交换空间

swapon /opt/temp/swap

4.修改/etc/fstab,使新加的4G交换空间在系统重新启动后自动生效.

echo "/opt/temp/swap swap swap defaults 0 0" >>/etc/fstab

5.看看swap大小free -h

6.不用重启也可以,直接重新git push发现问题解决.