36

I added some files to the repo, committed, and attempted to push to Github:

$ git add .  
$ git commit -m 'bla'  
$ git push origin master

I am getting an error when I try to push to Github.

Counting objects: 84, done.  
Delta compression using up to 2 threads.  
error: pack-objects died of signal 9  
error: failed to push some refs to 'git@github.com:xxxxx/xxxxx.git'

All was working fine before I went on vacation 2 weeks ago. Nothing has changed in the interim as far as I know. The config file seems to be fine. And git push -f also generates the same errors as above.

mnagel
  • 6,729
  • 4
  • 31
  • 66
Michelle Williamson
  • 2,516
  • 4
  • 18
  • 19

7 Answers7

64

Try this:

git config --global pack.windowMemory "32m"
pack.windowMemory::
    The maximum size of memory that is consumed by each thread
    in linkgit:git-pack-objects[1] for pack window memory when
    no limit is given on the command line.  The value can be
    suffixed with "k", "m", or "g".  When left unconfigured (or
    set explicitly to 0), there will be no limit.
Sridhar Sarnobat
  • 25,183
  • 12
  • 93
  • 106
asjer
  • 741
  • 5
  • 4
  • ran into this problem on Cloud 9 workspace free account..Running this command worked! – NiRUS Jul 02 '16 at 11:45
  • Had a pack-objects died of signal 952 after running the command "git repack -a -d -f --window=250 --depth=250" on a newly constructed svn to git conversion, this fixed that is well. THANKS! – James Eby May 16 '17 at 15:26
  • 2
    Neither this nor `git config --global pack.windowMemory "4096m"` made any difference to me. – Sridhar Sarnobat Sep 28 '21 at 23:19
  • This solved the problem on a tiny AWS t4g.nano instance I am using for testing. – paradroid May 25 '22 at 20:05
15

Git repack organizes unpacked objects into packs, which are a collection of objects, individually compressed, with delta compression applied, stored in a single file, with an associated index file.

    git repack -a -d -f --window=0
  • a: pack everything into a single pack
  • d: remove any newly redundant packs
  • f: don't reused old deltas, I guess to keep memory need down
  • window=0: stops comparisons with other objects to try to save space, I guess also to keep memory need down
Chris
  • 5,664
  • 6
  • 44
  • 55
hetal
  • 329
  • 2
  • 5
  • 7
    Please have a look at [How do I write a good answer?](https://stackoverflow.com/help/how-to-answer), and consider [providing some explanations along with your code](https://meta.stackexchange.com/questions/114762), so that future users can follow your ideas/code more easily. - [From Review](https://stackoverflow.com/review/low-quality-posts/23943100) – HansHirse Sep 02 '19 at 06:03
  • This seems to be working for my bloated repo, unlike the most popular answer. – Sridhar Sarnobat Sep 28 '21 at 23:25
  • Someone please copy and paste the relevant parts from here: https://git-scm.com/docs/git-repack (but it will make the post long). – Sridhar Sarnobat Sep 28 '21 at 23:31
  • Correction: this made no difference to the size of mine, though the command did complete successfully. – Sridhar Sarnobat Sep 29 '21 at 20:45
  • I have added some explanation to the answer (so am now getting the deserved downvotes - oops), but I don't think this actually fixes anything, it just re-attempts the pack operation that failed, with settings to try to use less memory. – Chris Jun 23 '22 at 09:57
3

On a FreeBSD box with a lean RAM profile and a large repository with many files, I started getting this error. The /var/log/messages file contained errors like this:

pid 93208 (git), jid 0, uid 1001, was killed: out of swap space

I was able to resolve this by adding a little more swap space temporarily.

Dave
  • 822
  • 1
  • 7
  • 17
1

I'm quite convinced you have a local problem and it's nothing to do with GitHub. A git push consists of the following steps:

  • local: delta compression of objects
  • net: Writing new compressed objects to remote repo via SSH
  • net: update refs in remote repo via SSH

Quite clearly, it's the first step that fails. You might be out of memory/swap?

SzG
  • 12,333
  • 4
  • 28
  • 41
0

In my case it was because the number of files that I wanted to add exceeded 100. If this is your problem you might want to push them in different commits.

Another explanation is that the files you want to push are too large.

0

Please check the RAM usages, or create more space for swapfile

Tung Luong Thanh
  • 377
  • 6
  • 11
-9

Had this problem pushing to Gitlab.

Fixed it by adding .* to my .gitignore

i.e. ignored all files/folders e.g. .git beginning with .

ericgm
  • 63
  • 3