我在本地做了几次提交而没有意识到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
您可以简单地重置您的状态,而不是包含apk文件(您可能不应该提交它们)。
你可以干脆做
git reset origin/master
保持更改但重置所有提交。
有一次,我把一堆全尺寸的照片交给了我的回购。以下是我从历史中完全删除它们所做的工作。
首先,我复制了回购。所以我有一个备份,以防我搞砸了。最好不要跳过这一步。 :-)
然后我在原始提交之前做了一个交互式rebase(rebase -i
),我不小心添加了照片。我放弃了照片的提交。
在变装后,我跑了
git reflog expire --expire=now --all
git gc --aggressive --prune=now
在你的情况下,也将app/releases/
添加到你的.gitignore
。