react-native: File android/java_pid14920.hprof is 311.59 MB; this exceeds GitHub's file size limit
Asked Answered
R

6

32

I would like to push my project into the github, however i just notice there is a file called java_pid14920.hprof inside the android folder and cause around 300MB

remote: error: File android/java_pid14920.hprof is 301.75 MB; this exceeds GitHub's file size limit of 100.00 MB

I wonder it is safe to delete this file ?

Rosinski answered 31/10, 2019 at 15:12 Comment(2)
Can you find a solution?Faintheart
Short answer is YES. You can (and prolly should) delete the Heap Dump File (.hprof). More info here in the Oracle Docs.Griffin
S
48

The only answer here didn't work for me, but I found a solution that did.

My offending file was android/java_pid2325.hprof, but yours obviously may vary. I used git filter-branch:

git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch android/java_pid2325.hprof'

Make sure to add *.hprof to your .gitignore and push the commit.

Note*-> Make sure to change the name of *.hprof to the same as your local *.hprof

Spry answered 27/9, 2020 at 2:27 Comment(4)
Thrilled to help! @RizwanIjazSpry
Thank you so much, its the best answer worked for me.Doxy
please how to add *.hprof to .gitignore ? I have 4 hprof files, do I add them all to gitignore ?Sedimentary
@Sedimentary solution courtesy of Hyeomin Go to ".gitignore" Just put this snippet. *.hprof Save .gitignore file.Spry
O
31

This sounds like a heap profiling output file, which you probably don't want in your repository at all. You'll want to delete it from the entire history and probably add an entry to .gitignore to ignore *.hprof. If the file is not in the latest commit, simply deleting it there won't make your repository pushable to GitHub; you'll have to remove the object from the entire history.

If you can easily find the commit which introduced it (try git log -- android/java_pid14920.hprof), you can do a git rm android/java_pid14920.hprof and then do git commit --fixup HASH-OF-COMMIT && GIT_SEQUENCE_EDITOR=true git rebase -ir --autosquash HASH-OF-COMMIT^ (note the caret) to rebase out the file.

You can also use a tool like git filter-branch or bfg to filter out large objects that you don't want.

Note that doing this will rewrite the history of any intervening commits, changing their object IDs.

Oregon answered 2/11, 2019 at 18:51 Comment(0)
S
8

I ran this command. It works on Windows 10

git filter-branch -f --index-filter "git rm --cached --ignore-unmatch android/java_pid10213.hprof"
  • Use " instead of '
Sabelle answered 16/7, 2021 at 14:2 Comment(0)
G
5

@bk2204 answer worked for me. In my case, .hprof files were in android/hprof.

  1. Go to ".gitignore"

  2. Just put this snippet.

android/

*.hprof

  1. Save .gitignore file.
Glaze answered 28/1, 2021 at 8:14 Comment(3)
I have manually deleted the hprof file. Then I ran git clean -f and tried pushing again. But, I keep getting the error message. Any workaround for this ?Bushhammer
But commit is already done, putting into .gitignore will work from next commit.Doxy
My problem was that I couldn't commit because of hprof size. So I put this line before I commit and it worked.Glaze
A
5

I had two hpprof files committed; So I just ran this command, and the files have been removed successfully.

git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch android/java_pid21295.hprof android/java_pid16516.hprof'
Akene answered 12/6, 2021 at 21:12 Comment(0)
N
1

This worked for me

git filter-branch -f --index-filter "git rm --cached --ignore-unmatch example/android/java_pid2243.hprof"

Then

git push -u origin main

Note:

My file was present in the directory like this.

example/android/java_pid2243.prof
Noeminoesis answered 24/1, 2022 at 13:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.