Git restore pack index file

I have a git repo with *.pack files – no loose objects.
For some reason ,not related to the question, all *.idx files are lost.
How can I restore them?


  • How to create/make your app LOCAL with Heroku/Virtualenv/Django?
  • git remote add with other SSH port
  • How to push / setup cloned github project
  • Rubymine — Configuring remote SDK?
  • Git detached head on newly cloned repo
  • Is git difftool on binaries possible? If so, how does one configure it?
  • Couldn't find any revision to build. Verify the repository and branch configuration for this job. Finished: FAILURE
  • git throwing broken pipe error on push
  • GIT:In the merge folder it is creating ~head file
  • Gitkraken stuck at opening repo
  • How Do I Pull a Single Commit In Git?
  • How to use a parenthesis character inside a command substitution inside a bash snippet inside a git configuration alias?
  • 2 Solutions collect form web for “Git restore pack index file”

    From the top of your tree, try running:

    git index-pack .git/objects/pack/PACK_FILENAME

    where PACK_FILENAME is the name of your pack file. For instance, a repository I tried this on had the path:


    You should do that for each pack file, and you’re repository should be in working order again.

    Note: “git index-pack --stdin” needs an access to an existing repository,
    but “git index-pack file.pack” to generate an .idx file that
    corresponds to a packfile does not.

    That means, from Git 2.12 (Q1 2017) on, you can even restore an idx file from outside a Git repo, for testing purpose.

    See commit 29401e1, commit a3c45d1, commit 7176a31, commit de95302 (16 Dec 2016) by Jeff King (peff).
    (Merged by Junio C Hamano — gitster — in commit 49d45de, 21 Dec 2016)

    index-pack: skip collision check when not in repository

    You can run “git index-pack path/to/foo.pack” outside of a
    repository to generate an index file, or just to verify the
    There’s no point in doing a collision check, since
    we obviously do not have any objects to collide with.

    Git Baby is a git and github fan, let's start git clone.