Somehow, I got into a state where I had some git repos that didn't have a refs
directory, but did have a packed-refs
file. When trying to use those repos, git would immediately error out with:
fatal: not a git repository (or any of the parent directories): .git
All I had to do was make an empty refs
directory, and git would work, and even report all the information about branches stored in the packed-refs
files.
Should a git repo without a refs
directory, but with a packed-refs
file really be considered invalid? How did my repos even get into this situation?
These repos were ones used by bundler
. For example, they were at:
/usr/local/lib/ruby/gems/2.3.0/cache/bundler/git/resque-841a12220f681ab6c7edba71d186ddfb64ee193f
Removing those directories, or creating the empty refs
dirs under them did the trick. It's still just confusing why this would happen.