0

Following this answer on SO- I understand that following git 1.8.4, submodules can be added from anywhere ( not just toplevel). I'm on git version 2.7.4 and when I do:

git submodule add ../../../functest

I get:

Relative path can only be used from the toplevel of the working tree

I'm in opnfvdocs/docs/submodules. I want to add opnfvdocs/functest inside opnfvdocs/docs/submodules such that I have relative path in .gitmodules

The tree structure is:

github.com/OPNFV
|-opnfvdocs
|-functest

Am I missing something?

Community
  • 1
  • 1
FlyingAura
  • 1,399
  • 4
  • 20
  • 35
  • You might want to read your link more closely... "Since the interpretation of a relative submodule URL depends on whether or not "remote.origin.url" is configured, ***explicitly block relative URLs in "git submodule add" when not at the top level of the working tree***." – jthill Dec 16 '16 at 07:10
  • So this means I have to configure `remote.origin.url` to point at `OPNFV`? – FlyingAura Dec 16 '16 at 07:18

1 Answers1

0

To create a submodule at a specific path, stay at top level, and provide the path as last argument:

opnfvdocs$ git submodule add ../functest docs/submodules/functest
Sjoerd
  • 71,634
  • 16
  • 123
  • 171