I am not sure what has happened, but git on the command line (Ubuntu 18.04) is not behaving.
When I am in my local repo space and check the status I get this
git status
fatal: not a git repository: ''
When I look at the directory structure, I see the .git directory and inside the git files.
HEAD is ref: refs/heads/master
When I try and re-init git I get this
git init
fatal: The empty string is not a valid path
I have even deleted the workspace directory and git clone
to pull the repo back from the remote source and I still get this weird issue with git.
When I move out of my workspace directory and create a directory elsewhere, and try and git init
I get the above fatal error message as well.
BUT... When I use vscode with GitLens, it works without an issue and vscode can see the repo and commits on that repo etc.
I am not sure what has happened to my git install. I was at, I think, 2.34 via a PPA. I purged the PPA and downgraded back to 2.17 (which is the latest that Ubuntu 18.04 technically supports)
I am wondering if some other library might be stopping git on the command line to be working correctly?
This can happen if the GIT_DIR
environment variable is set to ''
. If GIT_DIR
exists, git will use it to find the .git directory.
$ GIT_DIR='' git status
fatal: not a git repository: ''
$ GIT_DIR='' git init
fatal: The empty string is not a valid path
Unset that environment variable. How you do this depends on your shell.