Moving repositories with submodules is problematic
I think that initially I could configure Git in the App_V3 folder on the old OS
This is the source of the problem.
The version of Git is important when the original repository (or, more specifically, the reference submodule) was originally created.
Consider a repository with one submodule in vendor/awesome , how Git behaved when creating a submodule, completely different.
git version <1.7.8
The contents of vendor/awesome/.git is a folder - just like any Git check, so for example, the folder structure at the checkout will be:
.gitmodules .git ... vendor/ awesome .git config HEAD index packed-refs ...
There is no problem moving this type of repository, as there are no paths that are stored anywhere.
git version 1.7.8 or 1.7.9
1.7.8 moved the location of the submodal .git folder
When filling in a new submodule directory with "git subodule init", the $ GIT_DIR meta-information directory for submodules is created inside $ GIT_DIR / modules // superproject directory and a link through the gitfile mechanism. This allows you to switch between commits in a superproject that has and does not have a submodule in the tree without re-cloning.
Therefore vendor/awesome/.git not a folder, it is a file with the following contents:
gitdir: /absolute/path/to/main/repo/.git/modules/vendor/awesome
And the general folder structure:
.gitmodules .git ... modules vendor awesome config HEAD index packed-refs ... vendor/ awesome .git <- a file
The contents of .git/modules/vendor/awesome/config indicates where the working tree is located:
[core] ... worktree = /absolute/path/to/main/repo/vendor/awesome
This was a rather surprising change - however, it introduced a problem, since absolute paths were used to refer to places.
git version> = 1.7.10
In version 1.7.10 , the use of absolute paths in submodules was changed
The entire directory that hosts the top-level superproject managed by the "Git Submodule" can be moved to another location.
Now vendor/awesome/.git , if this or a later version of Git is generated, will contain:
gitdir: ../../.git/modules/vendor/awesome
The contents of .git/modules/vendor/awesome/config indicates where the working tree is located:
[core] ... worktree = ../../../../vendor/awesome
Again, there is no problem moving such a repository as paths relative to the main repository.
Moving repositories
With the old or new version of Git, you're good.
If you are sorry to work in the repository created in 1.7.8 or 1.7.9 (which, apparently, from the evidence in the question) and move the repository - there are 2 solutions :
- Clone again
- Valid paths in .git submodule files and corresponding worktree configuration settings