Git问题记录(三):error: The last gc run reported the following. Please correct the root cause and remove
1.问题
在使用git commit代码后,使用push命令后,出现了如题的提示!具体提示内容如下:
error: The last gc run reported the following. Please correct the root cause
and remove gc.log.
Automatic cleanup will not be performed until the file is removed.warning: There are too many unreachable loose objects; run 'git prune' to remove them.
了解一番之后,原因是因为提交的改动过多,导致本地的缓冲区占用太大,本地一些 “悬空对象”太多(git删除分支或者清空stash的时候,这些其实还没有真正删除,成为悬空对象,我们可以使用merge命令可以从中恢复一些文件)
2.解决方案
1.输入命令:git fsck --lost-found
,可以看到好多“dangling commit”
2.使用命令清空:git gc --prune=now
,完成
参考链接: