git限制了50M文件

想用github保存一下deepin的环境的app,结果push之后,却报了以下的错误

remote: warning: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: warning: See http://git.io/iEPt8g for more information.
remote: warning: File deepin.com.weixin.work_2.4.16.1347deepin0_i386.deb is 51.96 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: warning: File deepin.com.weixin.work_2.8.10.2010deepin0_i386.deb is 68.78 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
To https://github.com/aisna/deepinapp.git
 * [new branch]      master -> master
明显是github限制了

google一段时间,终于找到了方案,于是重新建立了一个仓库,重新处理一下

使用git-lfs解决超50m文件

GitHub LFS是一个开源的git扩展,可以让git追踪大文件的版本信息,官方地址是:https://packagecloud.io/github/git-lfs/install#bash-deb

安装git-lfs

按照官方的quick install安装完成后,到仓库里面执行却没能正常,于是尝试了ubuntu的apt方式,终于可以了。

sudo apt install git-lfs

在仓库里面初始化lfs

[email protected] ~/deepin_wechat_app (master)>git lfs install
Updated git hooks.
Git LFS initialized.

设置超大文件

[email protected] ~/deepin_wechat_app (master)>git lfs track "deepin.com.weixin.work_2.4.16.1347deepin0_i386.deb"
Tracking "deepin.com.weixin.work_2.4.16.1347deepin0_i386.deb"
如果有多个文件可以用*号做通配符

提交.gitattributes文件

[email protected] ~/deepin_wechat_app (master)>git add .gitattributes
add后,并没有什么提示,正常操作就行

完成后,commit并push就可以

注意:最后push有3次输入账号密码的情况,请不要怀疑自己的账号/密码是否输入错误了

最后感谢:https://blog.csdn.net/qianghaohao/article/details/79115108