Providing custom files for git submodule

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:

  • how to pull from remote git repository and override the changes in my local repository
  • Spellchecker error source tree
  • Folder level from GIT checkout on teamcity agent
  • Can't clone on windows but can clone on linux from Gitlab server
  • git-pull: could not detach HEAD for Unicode filenames
  • Git default files (ignoring after first pull)
  • machine/
    ├── Customfile
    ├── config
    │   └── nginx-config
    │       └── sites
    │           └── mysite.conf
    └── www
        └── mysite
            ├── vvv-hosts
            └── 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 machine/
    'machine' already exists and is not a valid git repo


  • Coda2 and Git: Git working, but no compare, push or pull
  • How to push bare repo branches to another remote?
  • git staging patches: with hunk smaller than a line
  • dyld: lazy symbol binding failed: can't resolve symbol
  • Git: Synchronize branch containing previously cherry-picked commits with master
  • Git pushing to cpanel server - git-receive-pack: command not found
  • One Solution collect form web for “Providing custom files for git submodule”

    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.

    Git Baby is a git and github fan, let's start git clone.