Well... it's in the comments, but for visibility:
This happens if you have a GIT_DIR
environment variable pointing to a particular repository. GIT_DIR
overrides the normal directory-search rules for finding the .git
folder and simply says "you're in a repo and the metadata is here".
Generally I would clear the GET_DIR
variable, and only set it when needed. I'm not sure what purpose you have it set for, and to the extent that purpose is still a thing, you may have to do some other stuff first to make sure it's set when it should be. But I can say the only times I've ever used GET_DIR
are in scripts (and then I make sure to clear it when the script's work is done) and I can't think of why you'd want it set all the time - for the reason you've just experienced.