无法 git push 因为文件太大

Nik*_*ntz 2 git github

我在本地做了几次提交,却没有意识到 github 不允许超过 100 MB 的文件,所以我有 4 或 5 次尝试推送,现在我什么也做不了。我应该做些什么?

$ git push
Counting objects: 114, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (96/96), done.
Writing objects: 100% (114/114), 48.24 MiB | 467.00 KiB/s, done.
Total 114 (delta 54), reused 0 (delta 0)
remote: Resolving deltas: 100% (54/54), completed with 10 local objects.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: bc3c170ddc8fcb18b4fd112e6036e0f7
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File app/release/app-release.apk is 139.72 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File app/release/app-release.apk is 135.97 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File app/release/app-release.apk is 105.54 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/montao/adventure.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/montao/adventure.git'

 git status
On branch master
Your branch is ahead of 'origin/master' by 8 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean
Run Code Online (Sandbox Code Playgroud)

Axn*_*yff 8

您可以简单地重置您的状态而不包含 apk 文件(您可能不应该提交它们)。

你可以简单地做

git reset origin/master
Run Code Online (Sandbox Code Playgroud)

保留您的更改但重置您的所有提交。


Rol*_*ith 5

有一次,我将一堆全尺寸照片提交到我的存储库中。以下是我为将它们从历史中完全删除而所做的事情。

首先,我制作了存储库的副本。所以我有一个备份,以防万一我搞砸了。最好不要跳过这一步。:-)

rebase -i然后,我在原始提交之前进行了交互式变基 ( ),其中我不小心添加了照片。我放弃了照片的提交。

变基后,我跑了

git reflog expire --expire=now --all
git gc --aggressive --prune=now
Run Code Online (Sandbox Code Playgroud)

根据您的情况,还要添加app/releases/到您的.gitignore.