git error Large files detected解决办法

来源:互联网 发布:nginx 403 权限 编辑:程序博客网 时间:2024/05/18 20:46

错误详情

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

image

参考官方说明:
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

filter-branch

然后修改.gitignore,提交

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

然后强制推送版本仓库

git push -f origin

push success

阅读全文
0 0