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
                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
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With