When I run git status on my repo I get fatal: Not a git repository: /my repo/.git/modules/docs
I've checked and .git exists and contains HEAD with the proper permissions. I can run various other commands fine. If I run git gui it opens fine and will list a couple of the changed files, but is missing a lot of them.
I'm guessing there may be some sort of corruption in HEAD, not sure though. Any idea how to fix this without wiping out the whole repo?
Update: I realized that I had changed the name of the repo's directory. The directory being referenced in the error is the old name of the directory. So my current repo is at /new dir/.git
but the error is saying Not a git repository: /old dir/.git/modules/docs
. So maybe git is confused?
Check that you correctly created the repo. If the directory doesn't contain a . git repo, use git init to properly initialize the repo or clone an existing repo. Make sure your HEAD file contains the correct information on your current branch.
The “Please make sure you have the correct access rights” error occurs if you do not have the right permissions to access a Git repository. To solve this error, make sure you are referring to the correct remote URL and that you have set up SSH authentication correctly.
Initializing a new repository: git init To create a new repo, you'll use the git init command. git init is a one-time command you use during the initial setup of a new repo. Executing this command will create a new . git subdirectory in your current working directory.
These two files contains absolute submodule path:
{submodule}/.git .git/modules/{submodule}/config
So, if you moved the repo, the absolute path in these two files are not valid, and cause the 'not a git repository' error. Just fix these files manually.
Former versions of git used an absolute path to locate the gitdir of a submodule. The solution is as follows:
rm -rf broken_submodule_folder
git submodule update
. You should see the submodules being checked out.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With