0

I'm trying to add a git repo with our corporate wp plugins to a wp project as a submodule:

git submodule add git@bitbucket.org:company/our-wp-plugins.git htdocs/wp-content/plugins/

Firstly I got this error:

'htdocs/wp-content/plugins' already exists in the index

So I removed it from the index with git rm -r --cached htdocs/wp-content/plugins, but this time I got another error:

'htdocs/wp-content/plugins' already exists and is not a valid git repo

Could I add somehow a submodule to an existing non-empty folder without creating a new subfolder?

Roman Dornhof
  • 169
  • 2
  • 3
  • 18

1 Answers1

3

Could I add somehow a submodule to an existing non-empty folder without creating a new subfolder?

No, a submodule will create its own root folder (which is actually a gitlink, a special entry in the index of the parent repo)

Make sure the .gitmodules has not already registered that path, and check the content of .git/modules folder, before attempting another git submodule add.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250