0

About one month about I've created bare git repository. And over last month I've been committing my source changes from eclipse to that repository over SSH.

The problem occurred today, when I tried to commit and push updates from eclipse. Here is whole error I've got:

Repository ssh://dany@192.168.0.18:22/home/dany/git/SVP2/
missing necessary objects
error: object file ./objects/60/916b83370c1535a4be9924e71e9954c01e82e0 is empty
error: object file ./objects/60/916b83370c1535a4be9924e71e9954c01e82e0 is empty
fatal: loose object 60916b83370c1535a4be9924e71e9954c01e82e0 (stored in ./objects/60/916b83370c1535a4be9924e71e9954c01e82e0) is corrupt
error: object file ./objects/60/916b83370c1535a4be9924e71e9954c01e82e0 is empty
error: object file ./objects/60/916b83370c1535a4be9924e71e9954c01e82e0 is empty
fatal: loose object 60916b83370c1535a4be9924e71e9954c01e82e0 (stored in ./objects/60/916b83370c1535a4be9924e71e9954c01e82e0) is corrupt

I can assume what is wrong, but I dont know how to solve it.

I think it may be related to the error on linux server where that repository is:

 Read-only file system

I don't know why and when my system switched to read only mode.

I'have back ups:

  • source code in my local machine in eclipse project, wich is also local git repository
  • git bundle file of this git repository

Can they be use to restore repository to working one?

Please help. I am frightened. I am quite new to git. I don't have any team member to ask for this. Please help.

-------------- Edit ---------------------

Thanks to: @codeWizard

On Remote bare repository

dany@192.168.0.18:~/git/SVP2$ git fsck --full
error: object file ./objects/06/b08928836077489d0ede51a0af42c7807b1943 is empty
error: object file ./objects/06/b08928836077489d0ede51a0af42c7807b1943 is empty
fatal: loose object 06b08928836077489d0ede51a0af42c7807b1943 (stored in ./objects/06/b08928836077489d0ede51a0af42c7807b1943) is corrupt
korbeldaniel@192.168.0.18:~/git/SVP2$ 

On Local working repository

dany@dany1l:~/git/SVP2$ git fsck --full
Checking object directories: 100% (256/256), done.
dany@dany1l:~/git/SVP2$ 
masterdany88
  • 4,009
  • 8
  • 44
  • 114

2 Answers2

2

As you can see its all about the same object.
Verify that the repository is in a "good" state:

git fsck --full

It will verify that all the files in your repository are in a "good" state.
In case of errors to any of the files it will display that a given hash is not good which means that if the file is in the list and its not a dangling state the checksum (SHA1) does not match the content.

It this case the file is corrupted.


If the file not corrupted

If you want to verify that the problem is not in your current branch, checkout last working master, create new branch form it and try to push the new branch.
If the push is working so you have verified that the problem is in one of your repository files.

Community
  • 1
  • 1
CodeWizard
  • 92,491
  • 19
  • 110
  • 133
  • Ok. File is corrupted. Can I do something about it? I've added to post result of command: `git fsck --full` – masterdany88 Jul 02 '15 at 11:42
  • you need to figure out which file is it to remove or to recover it. `git cat-file -p 06b08928836077489d0ede51a0af42c7807b1943` or: `git show 06b08928836077489d0ede51a0af42c7807b1943` – CodeWizard Jul 02 '15 at 13:07
0

I had normal dir and file backup of git repository in zip archive, which I used to restore, fix error.

  1. ~/git rename to ~/git_old_corrupted
  2. unzip git folders and files structured backup into ~/git
  3. commit and push to remote repository (one which was earlier corrupted)

This commit have pushed my all earlier commits at once.

Now it is back to normal again.

masterdany88
  • 4,009
  • 8
  • 44
  • 114