Providing custom files for git submodule
My project uses Varying-Vagrant-Vagrants as a submodule in
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
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
One Solution collect form web for “Providing custom files for git submodule”
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.