I am getting this error in my git repository:
22:09:15 $ git status
# On branch master
error: Could not read 8124cc15c63be92d534e4cdfa33c38d54deee122
error:
I had the same problem. After a lot of hair-pulling, I discovered that it was cause by changed permission to the repository's git files. I have solved it as follows:
$ cd .git
$ chmod 755 *
Done!
I got a similar error in my Homebrew install’s Git repository. Rather than restoring all the missing objects one by one, I found it easier to simply delete the .git
directory and create it again by re-cloning from Homebrew’s public repository. These were my steps:
git remote -v
, which contains the names and URLs of your remotes, so you can manually add them back later..git
directory (or rename it to .git-broken
and delete it later). On the command-line, this is rm -rf .git
.git clone https://github.com/Homebrew/homebrew.git
or whatever URI.homebrew
named after the repository. You want just the .git
directory from that; your local files are already okay. So mv homebrew/.git .git
, and then delete the homebrew
folder.git remote add <name> <url>
.git reset HEAD^
and saving the working directory to a stash again with git stash save <custom-message>
.If you run git fsck
, you should see no errors:
$ git fsck
Checking object directories: 100% (256/256), done.
Checking objects: 100% (197135/197135), done.
Checking connectivity: 197162, done.
$
And git stash list
, git branch
, and git remote -v
should show the same output as before.