6

My project uses Varying-Vagrant-Vagrants as a submodule in /machine.

VVV offers the possibility to configure it through custom files. My custom files are:

machine/
├── Customfile
├── config
│   └── nginx-config
│       └── sites
│           └── mysite.conf
└── www
    └── mysite
        ├── vvv-hosts
        ├── vvv-init.sh
        └── wp-cli.yml

These paths are all ignored in VVV's .gitignore file.

What's a good way of providing these files in my project so that they sit in the same directory as vvv when the whole project is recursively cloned? Hopefully without having to make a fork that tracks these files.

Simply adding the submodule with these files present has the following result:

$ git submodule add https://github.com/Varying-Vagrant-Vagrants/VVV.git machine/
'machine' already exists and is not a valid git repo

Thanks

Alain Jacomet Forte
  • 4,575
  • 6
  • 29
  • 41
  • Perhaps using symlinks would work? http://stackoverflow.com/questions/14831877/git-include-files-from-other-repositories/22179091#22179091 – onionjake Apr 22 '15 at 20:38
  • Just to clarify, all these files in the `machine` subdirectory are your own files, right? And you'd like to somehow clone and get a copy of the VVV project with your `machine` subdirectory, and all its files, inside it? – palimpsestor May 24 '15 at 14:45
  • Yes @palimpsestor, that is correct – Alain Jacomet Forte May 25 '15 at 20:28

1 Answers1

0

From git help submodule,

Submodules allow foreign repositories to be embedded within a dedicated subdirectory of the source tree, always pointed at a particular commit.

Your invocation of git submodule add is complaining because you are trying to embed the foreign VVV repository in the subdirectory machine, which, as the message said, already exists and is not a valid git repo.

To get your desired directory structure, with machine as a subdirectory of the VVV directory, you'd have to have your repo as a submodule of theirs, not the other way around.

Given that, I don't see how you could get a single git clone to pull both repos and organize them as you'd like. Next best might be to have your repo pull the VVV repo as a submodule/subdirectory parallel to your machine directory and include a script to establish a symlink to machine from inside the VVV subdirectory.

palimpsestor
  • 1,038
  • 1
  • 8
  • 28