3

I had lots related code scattered around which I decided to consolidate into one github repo. I accidentally commited, pushed, moved and removed larger files (greater than 50MB). I'm not very experienced with git and so did lots of things like using mv/rm instead of git mv/rm. I retrospectively tried to correct this but am not sure if I've just confused things.

Since doing all that when I try to push I just get:

-bash-4.1$ git push
Counting objects: 1288, done.
Delta compression using up to 8 threads.
Connection to github.com closed by remote host.
fatal: The remote end hung up unexpectedly
compressing objects:  87% (1060/1211)

But it just seems to hang there. Is there a way to tell if there's a problem or if I just need to wait longer?

I tried to increase the post buffer with:

-bash-4.1$ git config --global http.postBuffer 157286400

but this didn't seem to help.

To give you and idea of the repo/file sizes I did:

-bash-4.1$ du -sh *
126M    mg
4.0K    readme.md

-bash-4.1$ find ./ -type f -size +50M -exec ls -lh {} \;
-r--r--r-- 1 oc13378 emat13r 55M Oct 25 18:48 ./.git/objects/a6/c86199d33fac72d856d3381fe07239d7089b80
-r--r--r-- 1 oc13378 emat13r 65M Oct 25 19:00 ./.git/objects/d6/c82684b7db5939dbec6193d9a16b9b0954740c
-r--r--r-- 1 oc13378 emat13r 56M Oct 25 18:57 ./.git/objects/bd/0a85627a6fe53e0322ebf33c70d1ad1f26642b
-r--r--r-- 1 oc13378 emat13r 67M Oct 25 18:56 ./.git/objects/63/4209365d534cc6dd7d081c949b123df8052bd0
-r--r--r-- 1 oc13378 emat13r 60M Oct 25 18:55 ./.git/objects/2b/25a30d92e48a72e32d7062a4c5ffc5734fec94
-r--r--r-- 1 oc13378 emat13r 58M Oct 25 18:46 ./.git/objects/50/5495be51d3d8bd98b0c67a3ed41859fc92153f
-r--r--r-- 1 oc13378 emat13r 58M Oct 25 19:03 ./.git/objects/38/99700d5472df9442e118c82dd8fe9ee336bc5b
-r--r--r-- 1 oc13378 emat13r 52M Oct 25 18:44 ./.git/objects/b4/42ac818898e285c524e9300ecfa46ca53a2c3c
-r--r--r-- 1 oc13378 emat13r 54M Oct 25 19:00 ./.git/objects/4f/386fbc1389074f548a70a7a6f6e65df1a57710
-r--r--r-- 1 oc13378 emat13r 53M Oct 25 18:55 ./.git/objects/37/c25b249642f200c8e5c427d1c6d9b57c5ed089
-r--r--r-- 1 oc13378 emat13r 51M Oct 25 18:37 ./.git/objects/e9/54a09381e8e9a452a672886536718f73587e31
-r--r--r-- 1 oc13378 emat13r 52M Oct 25 18:37 ./.git/objects/b2/3ab90e379e2647c0bb9ccfdc6346b2c3d8df8f
-r--r--r-- 1 oc13378 emat13r 57M Oct 25 18:59 ./.git/objects/ac/ca72cfb9a4537828fd747b0a05ec0a79efdc65
-r--r--r-- 1 oc13378 emat13r 55M Oct 25 18:47 ./.git/objects/2e/da077ed31886e677dcb2b4bc6b1abe340527b6
-r--r--r-- 1 oc13378 emat13r 56M Oct 25 18:41 ./.git/objects/2e/d7ea9d06803d85ce9504c69619c516c2bac928
-r--r--r-- 1 oc13378 emat13r 51M Oct 25 18:45 ./.git/objects/04/b1e3fdcf9bc74c696f77c3b7d5f0d2fa5be992
-r--r--r-- 1 oc13378 emat13r 59M Oct 25 18:57 ./.git/objects/d5/355a991c4812379649e94123feb518160cc6cb
-r--r--r-- 1 oc13378 emat13r 53M Oct 25 18:56 ./.git/objects/ec/93271bb4b898438b2c90b7048a26f8dc54b553
-r--r--r-- 1 oc13378 emat13r 63M Oct 25 18:47 ./.git/objects/85/e33df7c1882788b12ee866d8c38427bd22aa44
-r--r--r-- 1 oc13378 emat13r 55M Oct 25 18:48 ./.git/objects/ce/70d6d87e7d810c570da3e2e534213653c05de6
-r--r--r-- 1 oc13378 emat13r 57M Oct 25 18:37 ./.git/objects/7a/abe86d346247dceadb0324696a044331f56440
-r--r--r-- 1 oc13378 emat13r 51M Oct 25 18:46 ./.git/objects/2a/d85020500a36387d60046c9e5ddf500aa44286
-r--r--r-- 1 oc13378 emat13r 59M Oct 25 18:59 ./.git/objects/fb/6928f2f569361935db50d4f0ed8ece5feaf6f1
-r--r--r-- 1 oc13378 emat13r 54M Oct 25 19:01 ./.git/objects/c6/c2843b3b40bf6c6b7b6f974f004009b8e45e4e
-r--r--r-- 1 oc13378 emat13r 56M Oct 25 18:47 ./.git/objects/fe/0b521c082fb0290bb011c73daba372b4805db4
-r--r--r-- 1 oc13378 emat13r 61M Oct 25 19:02 ./.git/objects/5a/373c53b589d429eff09e1d2a18d9b7f85658cf
-r--r--r-- 1 oc13378 emat13r 53M Oct 25 18:37 ./.git/objects/bb/e662205d31a9ccbd2d755fc46f99aae4bd0fe2
-r--r--r-- 1 oc13378 emat13r 51M Oct 25 18:37 ./.git/objects/69/32e59d33eae1e13357d0e048dee3f77b97ba72

One last things is that the computer is old and doesn't have much RAM. Could this be a problem?

-bash-4.1$ free
              total       used       free     shared    buffers     cached
Mem:       8059876    1112512    6947364          0       6372     927848
-/+ buffers/cache:     178292    7881584
Swap:      4194300      31156    4163144
-bash-4.1$ free -m
              total       used       free     shared    buffers     cached
Mem:          7870       1086       6784          0          6        906
-/+ buffers/cache:        174       7696
Swap:         4095         30       4065

My most recent try ended in failure:

-bash-4.1$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 5 commits.
#
nothing to commit (working directory clean)
-bash-4.1$ git push
Counting objects: 1288, done.
Delta compression using up to 8 threads.
Connection to github.com closed by remote host.
fatal: The remote end hung up unexpectedly
error: pack-objects died of signal 9)   
error: pack-objects died with strange error
error: failed to push some refs to 'git@git-uni:OliCUoB/wc.git'
Oli
  • 33
  • 1
  • 6

4 Answers4

3

One last things is that the computer is old and doesn't have much RAM. Could this be a problem?

Yes. The signal 9 means your pack process (building a thin pack to send off to GitHub) has been killed by the "OOM killer". See also Git out of memory and then fatal - early EOF (which is a case where the server ran out of memory, hence a bit different).

You can try fussing with the packing parameters on your side:

  • core.packedGitWindowSize
  • core.packedGitLimit
  • pack.window
  • pack.depth
  • pack.windowMemory
  • pack.deltaCacheSize
  • pack.threads (not specifically memory related, but more threads = more RAM needed)

but your best bet is to give your machine more memory (real RAM, swap / paging space, or both).

Community
  • 1
  • 1
torek
  • 448,244
  • 59
  • 642
  • 775
2

This solved for me

git reset origin/branchName

git add -a, git commit -m "commit message"

git push

Nagibaba
  • 4,218
  • 1
  • 35
  • 43
0

One additional setting can help speed up a git push:

git -c push.useBitmaps=false push

With Git 2.38 (Q3 2022), "git push"(man) sometimes perform poorly when reachability bitmaps are used, even in a repository where other operations are helped by bitmaps.
The push.useBitmaps configuration variable is introduced to allow disabling use of reachability bitmaps only for git push.

See commit 82f67ee (17 Jun 2022) by Kyle Zhao (yefengzkk).
(Merged by Junio C Hamano -- gitster -- in commit 81705c4, 13 Jul 2022)

send-pack.c: add config push.useBitmaps

Signed-off-by: Kyle Zhao

Reachability bitmaps are designed to speed up the "counting objects" phase of generating a pack during a clone or fetch.
They are not optimized for Git clients sending a small topic branch via git push.
In some cases (see this thread, using reachability bitmaps during "git push"(man) can cause significant performance regressions.

Add a new "push.useBitmaps" configuration variable to allow users to tell "git push" not to use bitmaps.
We already have "pack.bitmaps" that controls the use of bitmaps, but a separate configuration variable allows the reachability bitmaps to still be used in other areas, such as "git upload-pack"(man), while disabling it only for git push".

git config now includes in its man page:

push.useBitmaps

If set to "false", disable use of bitmaps for "git push" even if pack.useBitmaps is "true", without preventing other git operations from using bitmaps.
Default is true.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

I also faced some unexpected slowness for each operation in git. Then I use

git prune