这两天我试图把我的项目(在git上)拉到我的服务器上。我的服务器有1GB内存,使用Ubuntu。(其他进程通常使用200 by的RAM )。
当我在服务器上运行git pull origin master时,它会抛出以下内容:
致命:内存不足,malloc失败(尝试分配533517295字节) 致命:索引包失败

这里也是nano .git/config的结果
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
packedGitLimit = 512m
packedGitWindowSize = 512m
[remote "origin"]
url = https://***@bitbucket.org/***/***.g$
fetch = +refs/heads/*:refs/remotes/origin/*
[pack]
threads = 1
deltaCacheSize = 512m
packSizeLimit = 512m
windowMemory = 512m老实说,我无法为我的服务器获得更多的RAM。你知道我怎么才能把我的项目放到服务器上吗?
注意到在现实中有实名而不是***。
发布于 2018-07-09 10:56:46
要限制在获取操作期间使用的内存量(git pull使用git fetch),可以使用--depth标志。
只需运行git pull --depth=10并将其增加到number以获取越来越多的历史记录(或者,如果内存不足,则减少历史记录)。一旦在历史记录中加载了足够多的对象,就可以使用git fetch --unshallow请求剩余对象。
深度拉动的缺点是存储库将占用磁盘上更多的空间,因为它还必须考虑回购的多个状态。
https://stackoverflow.com/questions/51243393
复制相似问题