Search code examples
gitrsyncgit-submodules

Failure initializing submodules from a bare repo cloned from an rsync'd repo


I'm having a problem initializing submodules after a convoluted process of setting up the repository:

  1. Clone a remote bare repo with submodules.
  2. Initialize and update submodules in this repo. Everything is cool here.
  3. Create a local bare repo by cloning the non-bare local repo. (I said convoluted, right?)
  4. rsync this repo to machine X (which does not have access to the original remote)
  5. Make a non-bare clone the rsync'd repo on machine X.
  6. Attempt to initialize and update the sub-modules on the new repo.

The result of step six:

fatal: repository '/some/dir/foo.git' does not exist

The superproject directory was cloned into /some/dir/project/.

The process is so convoluted because: step 1 is painfully slow and machine X has no access to the original repository because of networking restrictions.

So within these constraints (I could re-do step 1, if necessary, perhaps creating a local bare repository straight away) is it possible to achieve what I'm trying to do here?

Thanks.


Solution

  • .gitmodules is more what you'd call "guidelines" than actual rules.

    My first attempt would be

    • also rsync the submodule repos to the step-4 machine, and
    • in the step-6 repo, for each submodule,
      • git config submodule.modulename.url url://step-4/path/to/subrepo
    • retry the submodule updates