5

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?
3

1 Answer 1

6

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.

Sign up to request clarification or add additional context in comments.

7 Comments

I run git rm --cached java_pid66619.hprof but get error: fatal: pathspec 'java_pid66619.hprof' did not match any files
@Leem No problem. That means it is already deleted in HEAD, but probably still present in one of the commits you are trying to push. git filter-repo will get rid of it for you. Save your repository first, to be safe.
My previous commit is the 1st commit of this repo which is just a README.md file
I also tried git filter-repo --path java_pid66619.hprof --invert-paths But I get this: git: 'filter-repo' is not a git command. See 'git --help'.
@Leem Yes, you need to install it first: github.com/newren/git-filter-repo/blob/master/INSTALL.md
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.