tags:

views:

1241

answers:

2

New git user. After "git init", I added and committed a few files. Made some changes, added and committed. Set up the git daemon (running under Cygwin on WinXP) and cloned the repository once. Now, I get this error with the cloned repository:

$ git status
error: bad index file sha1 signature
fatal: index file corrupt

Is there any way to fix this, other than getting a new copy of the repository? Thanks.

+1  A: 

This sounds like a bad clone. You could try the following to get (possibly?) more information:

git fsck --full
Gav
+13  A: 

You can simply remove the index

$ rm -f .git/index

(make a backup copy if you want), and then restore index to version in the last commit:

$ git reset

(which is shortcut for "git reset --mixed HEAD"). Or you can use lower level (plumbing) 'git read-tree' instead of 'git reset'.


If the problem is with index for packfile, you can recover it using 'git index-pack'.

Jakub Narębski