这个问题在这里已经有了答案:
How to remove/delete a large file from commit history in the Git repository?
(21 个回答)
2年前关闭。
我正在使用 Intellij IDE 开发 Java AWT 应用程序。在我 git 提交我的代码后,我推送到存储库:
me@mine-laptop myproject (master)$ git push origin master
Enumerating objects: 77, done.
Counting objects: 100% (77/77), done.
Delta compression using up to 4 threads
Compressing objects: 100% (58/58), done.
Writing objects: 100% (76/76), 114.51 MiB | 957.00 KiB/s, done.
Total 76 (delta 5), reused 1 (delta 0)
remote: Resolving deltas: 100% (5/5), done.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 41b3b658daba463dbc5ad37bce34f785
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File java_pid66619.hprof is 661.61 MB; this exceeds GitHub's file size limit of 100.00 MB
To github.com:myname/myproject.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@github.com:myname/myproject.git'
它提示我有一个大文件
java_pid66619.hprof
git push 失败。然后我将该文件添加到我的
.gitignore
并再次 push ,但仍然是同样的错误。然后我运行命令
ls -la
,我没有看到那个大文件 java_pid66619.hprof
.我知道大文件是堆转储。我的问题:
ls -al
的文件但是git sill在推送时会提示吗? 最佳答案
先试试
git rm --cached java_pid66619.hprof
至少,您的 .gitignore 将是有效的。
但是,如果在提交此删除后,推送仍然失败,这意味着(巨大的)文件是先前提交的一部分。
即使你删除并忽略了一个文件,如果它是过去提交的一部分被推送,那也足以使所述推送操作因同样的原因而失败。
那就试试
git filter-repo --path java_pid66619.hprof --invert-paths
并用力推。
这使用新的
newren/git-filter-repo
, 其中 replaces BFG
and git filter-branch
My previous commit is the 1st commit of this repo which is just a README.md file
然后再次克隆存储库,将您的文件复制到新的本地克隆存储库中(减去,显然,巨大的),添加,提交和推送。
关于java - 当 git push 到远程仓库时出现错误 "File java_pid66619.hprof is 661.61 MB; this exceeds GitHub' s 文件大小限制为 100.00 MB",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60220448/