Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When git push to remote repo get error "File java_pid66619.hprof is 661.61 MB; this exceeds GitHub's file size limit of 100.00 MB" [duplicate]

I am developing a Java AWT application with Intellij IDE. After I git committed my code, I push to the repository:

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 '[email protected]:myname/myproject.git'

It complains that I have a large file java_pid66619.hprof which fails the git push.

Then I added that file to my .gitignore and push again but still the same error.

Then I run command ls -la, I don't see that large file java_pid66619.hprof. I know that large file is heap dump.

My questions:

  1. Why I don't see that file with ls -al but git sill complains it when push?
  2. Why I git ignored it but git still complains it?
  3. How to get rid of this issue?
like image 231
Leem Avatar asked Feb 14 '20 05:02

Leem


1 Answers

Try first

git rm --cached java_pid66619.hprof

At least, your .gitignore will be effective.

But if, after committing this deletion, the push still fails, that means the (huge) file was part of previous commits.
Even if you delete and ignore a file, if it was part of past commits being pushed, that would be enough to make said push operation fail for the same reason.

Try then

git filter-repo --path java_pid66619.hprof --invert-paths

And force push.

This uses the new newren/git-filter-repo, which replaces BFG and git filter-branch

My previous commit is the 1st commit of this repo which is just a README.md file

Then clone the repo again, copy your files in that new local cloned repository (minus, obviously, the huge one), add, commit and push.

like image 64
VonC Avatar answered Oct 02 '22 16:10

VonC