1

I want to use git as a version control for my system configuration. So I initialized a git repo in "/". However on every reboot my .git directory is deleted by the os: Raspbian.

However the .gitignore is not deleted.

On my desktop (Gentoo Linux) I do not have this problem.

Why is this happening? How can I prevent this behavior?

Update: I tested further and it seems: The system removes any dotted (hidden) directories in "/" but not files

I will use git submodules, so please do not suggest to init repos per dirs like /etc. I really want all of my configs in a git repo and some hierarchically nested repos (submodule) inside it.

  • 1
    I suggest you initialise your git repo in a sub-directory where you are actually going to do your work. You will probably end up wanting multiple such repos for different projects, so trying to put it in the root directory is very unlikely to be what you want. Try this: git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository Note "go to the project’s directory ". git – Geoff Apr 27 '16 at 17:23
1

The solution: I created a .git symlink to the real .git directory copied under a subdirectory now it works. However this is a very interesting behavior, and I am very curious about the reason.

So I asked a more specific question. Raspbian removes dotted directories from /, why?

  • Why do you want to put a git repo directly under /? This is a bad practice. – Jacobm001 Apr 27 '16 at 21:39
  • 1
    @Jacobm001 I want to version control my configs /etc, /usr and /var the others are in gitignore. The more complex configurations and apps will be in sub modules. If you really think this is bad practice, please explain it why? – atevm Apr 28 '16 at 7:33
  • Kudos for answering your own question. – Human Jul 27 '16 at 1:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.