SOLVED: Error on ‘git clone’ for Redis GitHub repository

If you encountered this error when trying to clone the Redis repository from GitHub recently, there is a solution. The error looks like this:

  $ git clone https://github.com/antirez/redis
  Cloning into 'redis'...
  remote: Counting objects: 42713, done.        
  remote: Compressing objects: 100% (33/33), done.        
  remote: Total 42713 (delta 15), reused 0 (delta 0), pack-reused 42680        
  Receiving objects: 100% (42713/42713), 19.29 MiB | 6.81 MiB/s, done.
  error: object 1f9ef1b6556b375d56767fd78bf06c7d90e9abea: \
  zeroPaddedFilemode: contains zero-padded file modes
  fatal: Error in object
  fatal: index-pack failed
  $

The problem is that your ~/.gitconfig file probably has this setting:

  [transfer]
          fsckObjects = true

…and/or perhaps these settings:

  [fetch]
          fsckobjects = true
  [receive]
          fsckObjects = true 

Solution: set the value(s) to false while you clone Redis, then set them back to true afterwards.

See also this discussion for more; that’s where I originally stumbled across the solution. I’ve now cross-linked between this post and a ticket in the Redis issue tracker.

Pro non-tip: you might think that running

  $ git config --global fsck.zeroPaddedFilemode ignore

so as to get

  [fsck]
  	zeroPaddedFilemode = ignore

in your .gitconfig would solve this problem in a nice targeted way, but it won’t, so don’t bother. See here for some discussion about that.

(This post is part of my SOLVED as a Service series, in which I post solutions to technical problems with open source software that I use. The point is the next time I encounter the same problem and do an Internet search, my own post will come up; this has now actually happened several times. If these posts help others, that’s a bonus.)

2 Responses to “SOLVED: Error on ‘git clone’ for Redis GitHub repository”

  1. Nathaniel Beaver Says:

    You can avoid editing your `~/.gitconfig` file by using the `-c` flag:

    git -c transfer.fsckObjects=false clone https://github.com/antirez/redis.git

    (I posted this on the Github issue tracker as well.)

  2. Karl Fogel Says:

    Thanks, Nathaniel! I just saw your comment over in GitHub as well.

Leave a Reply