1

Size of .git directory is 99 MB in my Java project. It blocks pushes with message:

error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large

I tried following commands:

git gc --auto
git filter-branch -f --tree-filter "rm -rf *.tmp" --prune-empty -- --all
git gc --aggressive --prune=now
rm -f .git/objects/*/tmp_*

Output of these commands:

$ git gc --aggressive --prune=now
Counting objects: 175, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (154/154), done.
Writing objects: 100% (175/175), done.
Total 175 (delta 75), reused 100 (delta 0)

$ git filter-branch -f --tree-filter "rm -rf *.tmp" --prune-empty -- --all
Rewrite 0d68ca0f7db205c48ae546515258ea2ffa763cb4 (1/12) (1 seconds passed, remaiRewrite 8db8b2340cb003b0b85e40d4e521473b189c2065 (1/12) (1 seconds passed, remaiRewrite b4376182b8c240c24174aa4dbb2aa88676a55fe7 (3/12) (13 seconds passed, remaRewrite 545753bd314e7143b1bc8cb5ad1a9b18d3bfd5d3 (4/12) (19 seconds passed, remaRewrite 4df0cb335acbdd3e32e9e169f859928066c1e791 (5/12) (26 seconds passed, remaining 36 predicted)
plaidshirt
  • 5,189
  • 19
  • 91
  • 181
  • Pushing to Github presumably? – Michael Aug 15 '17 at 13:26
  • 1
    *"Size of .git directory is 99 MB"* That ain't nuthin'. :-) *"It blocks pushes with message"* That's not going to be because of the overall size of your .git directory. – T.J. Crowder Aug 15 '17 at 13:27
  • Is this the first time you have pushed to this remote? Or have you added a large amount of data to the repository since your last push? Regardless, you generally don't want to be removing stuff within `.git`. – instantepiphany Aug 15 '17 at 13:27
  • 2
    @plaidshirt: could you please share the results of commands you tried? Also, maybe you have other binary files than *.tmp? – altern Aug 15 '17 at 13:34
  • 1
    @instantepiphany : I pushed earlier to this and haven't added to much files, whole size is 2 MB of the project. – plaidshirt Aug 15 '17 at 13:38
  • Ok, I am out of ideas for now. Maybe post the output of all the commands you have tried as @altern suggested. – instantepiphany Aug 15 '17 at 13:42
  • 1
    Possible duplicate: https://stackoverflow.com/questions/7489813/github-push-error-rpc-failed-result-22-http-code-413 – Vivek Chavda Aug 15 '17 at 13:47
  • @VivekChavda : Sorry, but it didn't help in this problem. – plaidshirt Aug 16 '17 at 06:49
  • @instantepiphany : I added some outputs too. – plaidshirt Aug 16 '17 at 07:38
  • Where are you pushing to? It could be that the git server is running on a web server like nginx and the web server is refusing the file as it is above it's limit. It may work using ssh, try that if possible. – instantepiphany Aug 16 '17 at 07:45
  • 1
    I very much doubt that Java is relevant here at all. Git doesn't care that they're Java files. – Jon Skeet Aug 16 '17 at 07:48
  • @instantepiphany : I have no `SSH` access to this server, but I don't know, how could `.git` folder uses up so much space. – plaidshirt Aug 16 '17 at 07:53
  • @JonSkeet who are you replying to regarding Java? plaidshirt this is an oversimplification, but you have 99MB of unique bits of data in your git history. If you have garbage collected already then I am not aware of anyway to reduce the size that won't drop old commits. But as T.J. Crowder said, 99MB is not a lot for a git repo, I highly recommend checking whatever server the repo is hosted on, I think may be a webserver issue. – instantepiphany Aug 16 '17 at 08:28
  • Can you tell us where you are pushing to? If it is a private server, that is fine, but knowing if you are pushing to GitHub or BitBucket (for example) helps narrow down what could be causing the issue. – instantepiphany Aug 16 '17 at 08:29
  • 1
    @instantepiphany: I'm referring to the fact that the question has the java tag and talks about Java (very briefly) in the question. I don't think it should have the java tag. – Jon Skeet Aug 16 '17 at 08:29
  • @JonSkeet Oh, that makes sense, and I agree completely, not a Java issue. plaidshirt, this might sound silly but are you pushing to a new, blank repository? Also, please have a look at this answer: https://stackoverflow.com/a/15021750/2374880 – instantepiphany Aug 16 '17 at 08:32

0 Answers0