Resolving git error: unable to create temporary sha1 filename

I’m just starting to use git for source control. Tonight I got an error when I tried to commit:

$ git add ./foo/bar/
error: unable to create temporary sha1 filename .git/objects/95: File exists

error: foo/bar/baz: failed to insert into database

Luckily, someone else ran into this before me. The magic incantation:

git fsck
git prune
git repack
git fsck

and then I was able to add my files.

I ran into another case where this didn’t help. In that instance,

git gc

was able to get me committing again.

About these ads

2 Responses to Resolving git error: unable to create temporary sha1 filename

  1. Max Williams says:

    Andrew – i’m suffering this same problem and have trawled the internets already to no avail. Can i ask – were you trying to push to a seperate (bare) repo that was in a different folder to your working folder? That’s my situation.

  2. andrewmemory says:

    I wasn’t doing that – I ran into this just trying to commit to a repository I created. I think the fact that it was on a Samba share and using the Cygwin git might have had something to do with that–I’ve noticed the Cygwin git has a few more warts than the Linux git.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: