I got this error when I used git rm
on a file in a directory.
I was in something like ~/gitRepo/code/newFeature
In newFeature there was only one file. I did a git rm
on that file then tried to create a new file myNewFile using vi.
Ubuntu showed me as still being inside the newFeature directory but actually git rm
had removed the whole directory.
I had to exit out of vi, navigate up one directory and then recreate the newFeature directory.