I’m not entirely sure what happened, but for some reason my git repository’s master ref file is now empty. We’re hosting the repository on Dropbox, so maybe it has to do with that..but now I can’t pull from it. It says this:
Your configuration specifies to merge with the ref 'master' from the remote, but no such ref was fetched.
Dropbox keeps versions of files, so if I go back to the previous version of ‘master’ it says:
fatal: object 2d154f82e59a4156a5d3ea04a0617c243ae6dc3a is corrupted
fatal: The remote end hung up unexpectedly
How do I recover from this?
Sigh.
I like Dropbox, but I would never recommend it for “hosting” Git repositories. Its synchronization works well enough for single-file documents, but it does not come close to providing the distributed/remote filesystem semantics that would be required for safe hosting of a Git repository.
Hopefully you are just “hosting” a bare Git repository on Dropbox. If so, you should be able to cobble together the commits and references from your non-bare (working) repositories. It should also be possible to manually recover your existing repository, but you will likely end up needing to copy objects from your other repositories anyway, so you might as well do it the following “high level” way (instead of going “low level” and dealing with copying objects from other repositories (or copying pack files and unpacking parts of them)).
Start by making an independent clone of one of your working directories.
Import the refs and objects from your other working repositories.
Then, look through all the branches on your new remotes and determine which branches should point to which commits for your rebuilt central repository.
The create and push your recovered branches (and tags) to a new bare repository.