0

I have a binary file of size ~11MB stored in repo. Now I updated this file locally and want to push the new version.

When I push it I see following:

$  git push --set-upstream origin feature/new-win-installer

git: 'credential-cache' is not a git command. See 'git --help'.
Counting objects: 291, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (231/231), done.
Writing objects:  20% (60/291), 34.49 MiB | 135.00 KiB/s

It's already 3 times bigger than original file so I aborted it. I have no other files in this commit.

What's wrong here? How could it be avoided?


I tried to delete the file completely, but I'm unable to do that too:

$  git push --set-upstream origin feature/new-win-installer
git: 'credential-cache' is not a git command. See 'git --help'.
Counting objects: 290, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (230/230), done.
error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
fatal: The remote end hung up unexpectedly
Writing objects: 100% (290/290), 115.55 MiB | 215.00 KiB/s, done.
Total 290 (delta 110), reused 136 (delta 33)
fatal: The remote end hung up unexpectedly
Everything up-to-date

Anything I can do without mixed reset to the point before I added the file?

Alex Zhukovskiy
  • 8,186
  • 2
  • 51
  • 123
  • If the push failed then you're better off, because versioning large binary files in Git is generally a really bad idea. Unless maybe if that binary is an image from your site or something, you are better off versioning it outside of Git. – Tim Biegeleisen Jun 20 '18 at 14:20
  • @TimBiegeleisen but 11mb is not a big file. IIRC github limit is ~100mb, which I'm defenitly not going to push. – Alex Zhukovskiy Jun 20 '18 at 14:21
  • Remember that you're not just pushing the files but the commit history as well. Git can't record single-line changes on a large binary file, so perhaps it's just making a copy. Git is based on line changes. – Dan Wilson Jun 20 '18 at 14:21
  • @DanWilson hmm, so if I remove the file and then add new one then it should work? Going to try. Thank you. – Alex Zhukovskiy Jun 20 '18 at 14:21
  • @AlexZhukovskiy Read Dan's comment, because each time the version changes, boom! You basically have to store the new version from scratch. Unless you are _certain_ that you'll never change that file, 11MB can easily grow to 100MB+. – Tim Biegeleisen Jun 20 '18 at 14:22
  • If you only want to send 11MB to the server then you'll actually have to purge commits where you changed the file. See [this](https://stackoverflow.com/questions/1338728/delete-commits-from-a-branch-in-git). – Dan Wilson Jun 20 '18 at 14:22
  • @DanWilson sounds great, however, I neved did it so I was just unaware of it. Going to check how it could be performed. Thank you. – Alex Zhukovskiy Jun 20 '18 at 14:24
  • It's not a commonly-used command, because you almost *never* want to lose commit history. – Dan Wilson Jun 20 '18 at 14:24
  • @DanWilson I actually don't want to lose the whole history too, I just want to update (or at least *remove*) this file in (from) git. I pushed a commit where I delete it, but I see the same behavior. I didn't think it's so hard for him to store binaries. – Alex Zhukovskiy Jun 20 '18 at 14:27
  • I'm not sure if it's a dupe. Linked issue talks about *gigabytes*, when mine is only 11mb. Git should easily handle files of such size. – Alex Zhukovskiy Jun 20 '18 at 15:47
  • Have you looked at similar errors: https://stackoverflow.com/q/46232906/8293848 – Hayati Gonultas Jun 20 '18 at 19:20

0 Answers0