0 votes
1 view
in Devops and Agile by (20k points)

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?

1 Answer

0 votes
by (28.4k points)

You may have accidentally corrupted the .git/index file with a sed on your project root (refactoring perhaps?) with something like:

sed -ri -e "s/$SEACHPATTERN/$REPLACEMENTTEXT/g" $(grep -Elr "$SEARCHPATERN" "$PROJECTROOT")

Also, to avoid this in future, just ignore binary files with your grep/sed:

sed -ri -e "s/$SEACHPATTERN/$REPLACEMENTTEXT/g" $(grep -Elr --binary-files=without-match "$SEARCHPATERN" "$PROJECTROOT")

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...