git clone 下载时报错: fatal: Out of memory, malloc failed

使用云服务器git clone某个项目时,遇到如下问题:

fatal: Out of memory, malloc failed (tried to allocate 2000000000 bytes)

百度后找到如下解决方法:

sudo mkdir -p /opt/temp
sudo dd if=/dev/zero of=/opt/temp/swapfile bs=1M count=1024
sudo chmod 600 /opt/temp/swapfile
sudo mkswap /opt/temp/swapfile
sudo swapon /opt/temp/swapfile
posted @ 2021-05-07 12:23  坚强的小蚂蚁  阅读(714)  评论(0编辑  收藏  举报