Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github: Send git objects incrementally (or in separate batches)

I have a repo that has a lot of small files (the .git directory is 4.2GB, but almost all the files are 4KB). When I try pushing it to Github, I get:

fatal: the remote end hung up unexpectedly
❯ git send-pack --all [email protected]:x/y.git
Connection to github.com closed by remote host.
send-pack: unexpected disconnect while reading sideband packet
Enumerating objects: 2033590, done.
Counting objects: 100% (2033590/2033590), done.
Delta compression using up to 2 threads
Compressing objects: 100% (1513323/1513323), done.
fatal: the remote end hung up unexpectedly

Can I send the git objects incrementally to Github to work around this?

PS: The same thing happens with Gitlab

❯ git push gl master         
Connection to gitlab.com closed by remote host.
send-pack: unexpected disconnect while reading sideband packet
Enumerating objects: 2033590, done.
Counting objects: 100% (2033590/2033590), done.
Delta compression using up to 2 threads
Compressing objects: 100% (1513323/1513323), done.
fatal: the remote end hung up unexpectedly
like image 924
HappyFace Avatar asked Nov 01 '25 21:11

HappyFace


1 Answers

The repo has been just created, so this is the first commit. So the best solution is to delete this commit, and create commits with a batch of files added at a time?

Yes: creating multiple smaller commits instead of one giant commit will ensure you will be able to push them.

As an example of such a push, see "Trying to push large number of commits in batches"

max=$(git log --oneline|wc -l); \
for i in $(seq $max -500 1); do \
  echo $i; \
  git push origin master~$i:refs/heads/master; \
done; \
git push origin master
like image 182
VonC Avatar answered Nov 03 '25 11:11

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!