Question

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.

Was it helpful?

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.

OTHER TIPS

A git repository holds all information about files in the .git folder, so when you remove it, you remove all information about the files of the inner repo. The files themselves have not changed, but the outer repo does not know about them, because it never did. It was the inner repo that knew about them, and that isn't there any more. You need to git add and git commit them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top