Error with git: " already exists and is not a valid git repo"

Even if the folder doesn't exist, check the index status:

cd libs/OAuth
git ls-files -- functions

If there is an entry registered in the index, you will need to remove it before being able to add your subrepos as a submodule.
(as explained in "Issue with adding common code as git submodule: “already exists in the index”")

All this assumes that you are at the root folder of a currently cloned repo, which will act as the parent repo of any submodule you would declare.


In case someone else had a similar case as mine and was struggling with this as I was because of a stupid reason:

Check if for any reason the file doesn't already exists (I had a failed git subomdule add previously)

So in the context of the question rm the file:

rm -rf libs/OAuth/functions

And then try to re add

Tags:

Git

Github

Oauth