git error Large files detected解决办法

xiaoxiao2021-02-28  70

错误详情

remote: warning: Large files detected. remote: error: this exceeds file size limit of 100.0M

参考官方说明: https://help.github.com/articles/removing-files-from-a-repository-s-history/ 但是这种方式只能清除最近的提交到版本库但未推送到远程仓库的文件

解决办法

这个方法里面提供了两种解决方案,https://help.github.com/articles/removing-sensitive-data-from-a-repository/

第一种方式,使用BFG repo-cleaner,

https://rtyley.github.io/bfg-repo-cleaner/ , 但是要使用java环境运行,我windows使用的git bash没有设置Java路径所以就没有用这种方式;

第二种方式,使用git-filter-branch

首先,清除异常的文件QMPlayer.VC.db

git filter-branch --indx-filter 'git rm --cached -- ignore-unmatch QMPlayer.VC.db' --tag-name-filter cat -- --all

然后修改.gitignore,提交

echo "QMPlayer.VC.db" >> .gitignore git add .gitignore git commit -m "Add QMPlayer.VC.db to .gitignore"

然后强制推送版本仓库

git push -f origin

转载请注明原文地址: https://www.6miu.com/read-1000063.html

最新回复(0)