gitversion-controlsubrepos

Git inside git: disconnect inner git, keep files


Summary

Git inside git. Removed the inner .gits, kept the files. Push. Clone. Folders exist, but are empty.

What I'm trying to do

So I'm trying to upload an existing repo to my own git server. The repo has some repos inside of it (that are not a part of the original repo). I don't need these to be connected, what is foremost important is stability - that cloning MUST produce a working copy of the PHP server files.

How I've tried

So I remove the .git folder from the inner repos and push the main one into empty git server. Then I clone the newly created remote repo in a new local dir - the folders that used to have .git are empty alltogether (the folders themselves do exist). I've also got GitLab installed and there the folder appears differently than normal folders, with no extra information to be found (notice folder "flashcard"):

enter image description here

Question

Is there any other way of removing git capabilities from folder? What keeps the folder from being just normal files? I am all out of ideas.

Other info

.gitignore and .git/ifno/exclude don't touch these directories.


Solution

  • Found the answer, finally.

    git rm --cached path/to/submodule (no / or * at the end)

    I haven't added these repos as submodules myself, but clearly they have been cached as such somehow.

    After clearing the cache you still need to add the files to the outer repo, as Peter suggested.