Mac 完美解决 this exceeds GitHub‘s file size limit of 100.00 MB

remote: error: Trace: 56e5c87d3324987fc365966e525acbb59b2e1174f75d35db8b8f32ba9a37b039        
remote: error: See https://gh.io/lfs for more information.        
remote: error: File AutoJsPro_9.3.11.apk is 124.32 MB; this exceeds GitHub's file size limit of 100.00 MB        
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.        
To github.com:dengzemiao/DZMAutojsProTools.git
 ! [remote rejected] main -> main (pre-receive hook declined)
错误:无法推送一些引用到 'github.com:dengzemiao/DZMAutojsProTools.git'
  • 原因就是不允许提交超过 100mb 的单个文件,可以通过 GitLFS 进行解决。

    GitLFS 需要单独安装 ,然后使用 gitlfsmigrateimportgitlfstrack 命令管理大文件(如.h5),添加 .gitattributes 文件,最后正常 push 即可。

  • 下载并安装 Git 命令行扩展。下载并安装后,运行以下命令为您的用户帐户设置 Git LFS

    # 先这个
    $ brew install git-lfs
    
    # 后这个
    $ git lfs install
    
  • 设置希望 git lfs 管理的文件或者文件类型,从这行开始需要到项目中使用,确保项目是 git 仓库项目。

    $ git lfs migrate import --include='*.apk'
    $ git lfs track '*.apk'
    
  • 确保 .gitattributes 被跟踪:

    $ git add .gitattributes
    
  • 最后正常提交代码

    $ git add .
    $ git commit -m 'add'
    $ git push -f origin master 
    

猜你喜欢

转载自blog.csdn.net/zz00008888/article/details/143159963