4

I'm trying to add a submodule, as I normally would do, I did:

git submodule add -f -b master 'https://github.com/OrganicDesign/extensions/tree/master/MediaWiki/PdfBook/'

Only it gives me

fatal: repository 'https://github.com/OrganicDesign/extensions/MediaWiki/PdfBook/' not found since it does not recognize this as a git repository. 

Is there anyway to add this submodule (without having to fork anything; so I can keep the upstream)?

Ayman Nedjmeddine
  • 11,521
  • 1
  • 20
  • 31
Reception123
  • 73
  • 1
  • 9

1 Answers1

1

The way git submodule works is that you have to provide it a root link for the repo you want to add.

Fro instance:

git submodule add -f -b master https://github.com/OrganicDesign/extensions.git

If you want to access files and directories down the repository tree you would have to do it locally.

Ayman Nedjmeddine
  • 11,521
  • 1
  • 20
  • 31
  • 1
    Thank you. The problem is I really don't want anything else from the root repo (quite a lot of things) and I only need that specific part of it. – Reception123 Jul 23 '17 at 07:10
  • 2
    What you are looking for is a mixture of sub-modules and [sparse checkouts](https://stackoverflow.com/a/13738951/4000674). The latter is the way of cloning only a sub-directory of a repo. I don't know if `git` provides a way of doing that with a single command, but it can be done either manually or automated with a script. – Ayman Nedjmeddine Jul 23 '17 at 07:29