Hi All,

I am currently working on a project, call it A, which contains several 
sub-projects B, C, D.  The B, C, D are actually experimental input and 
outputs for simulation runs, which I need to keep track of the daily 
changes.  Most of these calculations are done on workstation, but I do need 
to occasionally clone the repositories to other machines, and then push the 
updates back.

I version track B, C and D with independent git repositories, and 
organisationally it makes sense for them to be subdirectories of A.  I 
would like to version control the overall project A, with B, C, D as 

This is easily done on the main workstation (I will call it W1), with:

cd A
git init
for ii in B C D ; do
  git submodule ./${ii}/.git
git add .
git commit

Repository A/.git on W1 does not have an origin.  All seems to work fine 
with this step up on W1.

HOWEVER, problem starts to appear when I attempted to clone the overall 
repository A to another workstation W2:

git clone W1:<path to A on W1>/.git  <path to A on W2>
cd <path to A on W2>
git submodule init
git submodule update

git then produces an error indicating that:

W1:<path to A on W1>/.git/B/.git

is not a valid repository (i.e. directory not found)

The extra .git has been inserted in the URL to submodule repository B, C, 
and D.

This can be solved by changing the .gitmodules file, replacing ./B/.git to 
../B/.git,  and then git submodule sync on W2.

However, this is far from being an optimal solution, because if .gitmodules 
on W1 is updated accordingly, then the submodule repository for B would 
point to

<path to A on W1>/../B/.git

which will be incorrect.  I could in principle define the URL for the 
submodule repositories as absolute paths, but keeping them relative to A 
has many advantages, such as I will be able to move A around, without 
effecting the main repositories on W1 in anyway, and I can rsync them to 
another disk for backup etc.

I would be very grateful if someone can offer me an solution to my problem.

Many thanks in advance!


You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to