Git push失败,因为大文件错误(Flutter SDK)[重复]

njthzxwz  于 2023-09-29  发布在  Git
关注(0)|答案(2)|浏览(185)

此问题已在此处有答案

How to remove/delete a large file from commit history in the Git repository?(23个回答)
13天前关闭
我对堆栈溢出的研究再多也没有找到解决方案。

PS C:\Users\benia_6dpynbz\StartupApp> git push origin BensVersion
Enumerating objects: 933, done.
Counting objects: 100% (878/878), done.
Delta compression using up to 12 threads
Compressing objects: 100% (362/362), done.
Writing objects: 100% (515/515), 97.78 MiB | 1.17 MiB/s, done.
Total 515 (delta 197), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (197/197), completed with 24 local objects.
remote: warning: File build/app/intermediates/assets/debug/flutter_assets/kernel_blob.bin is 56.58 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: Trace: 4583cbfce6b24514a767f7cb761905a033855f92fceda479732f91b36bf91249
remote: error: See https://gh.io/lfs for more information.
remote: error: File build/app/outputs/apk/debug/app-debug.apk is 101.46 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 https://github.com/mattwalter2/StartupApp
 ! [remote rejected] BensVersion -> BensVersion (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/mattwalter2/StartupApp'

如果你能帮忙的话,我将不胜感激。
My.gitignore设置为通过包含/build/来排除构建目录中的所有文件。我尝试了flutter clean和我能想到的每一种方法来试图摆脱构建文件,但下面的终端消息仍然出现。它只是不允许任何类型的推送到远程存储库。

ioekq8ef

ioekq8ef1#

因为你的提交有.apk文件,这个太大了。你不需要将这个文件添加到git。要解决这个问题,您可以将这些添加到您的.gitignore

#built application files
*.apk
*.ap_
*.aab
i86rm4rw

i86rm4rw2#

用这个gitignore

# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/ios/Flutter/.last_build_id
.dart_tool/
.vscode/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
.vscode/launch.json
ios/Flutter/Release.xcconfig
ios/Flutter/Debug.xcconfig
macos/Flutter/Flutter-Debug.xcconfig
macos/Flutter/Flutter-Release.xcconfig

这将删除运行时生成的所有生成配置和文件。答案源-https://stackoverflow.com/a/70369953/22228906

相关问题