3

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.

krivar
  • 342
  • 1
  • 3
  • 16

2 Answers2

4

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.

Community
  • 1
  • 1
krivar
  • 342
  • 1
  • 3
  • 16
0

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.

Peter Westlake
  • 4,894
  • 1
  • 26
  • 35
  • this is incorrect. As there is nothing to add. I have the original repo (with inner repos) that I can duplicate and try as many times as I like. When I remove the `.git` folders from inside, the files do not become visible with `git status`. Thus, there is nothing to add. – krivar Feb 25 '14 at 11:11
  • also manually adding `git add path/to/folder` does not add anything to be commited. – krivar Feb 25 '14 at 11:17
  • but git does keep it store somewhere - if I rename the folder; commit; and name it back - now it registers a delete, but not an add. The directory is as if completely missing as far as git is concerned. – krivar Feb 25 '14 at 11:36
  • So this turned out to be a valid point, but the real problem was, that the directory was cached - see my own answer. – krivar Feb 25 '14 at 11:46