Answer a question

It is seying that I cannot do this:

 git submodule add -f git@github.com:thephpleague/oauth2-server.git libs/OAuth/functions

Because of this:

'libs/OAuth/functions' already exists and is not a valid git repo

I just don't get it. It does not exists anywhere. Is there another git config file hidden on my computer that I don't know of or something? I tried deleting .git and pulling everything again that did not do anything. Any ideas?

I also tried this:

git ls-files --stage functions

When I was inside of libs/OAuth and I got nothing.

Then I tried this:

sudo git rm --cached functions

I got this error:

fatal: pathspec 'functions' did not match any files

I also tried this:

sudo git rm -r --cached functions

And got the same previous error.

Answers

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.

Logo

ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!

更多推荐