Git is ignoring .git directories in subdirectories

I’m using git as a backup tool and ‘roaming profile’ for my $HOME directory between laptop and desktop.

My problem is that under my $HOME I have a Development directory with multiple git projects I’m working on. Git will not allow me to add the subdirectories .git folders. So to commit to these projects I have to push the changes into my $HOME git repo, pull on laptop (where they were created and .git dir exsits) and commit.

  • Restoring to an old git checkout while keeping attached to a branch
  • Are concurrent git pushes always safe if the second push only has fast-forwards from the first push?
  • Does Github auto backup our projects into globally spread mirrors, like SourceForge?
  • GitLab Incremental BackUp
  • Is “git push --mirror” sufficient for backing up my repository?
  • GitHub: “Some uncommitted changes would be over written by syncing”
  • I’ve read about submodules, but it’s not really what I want. I just want the children .git folders to be treated like any old directory so I can move them around and back them up.

    Has anyone done this or have an idea how I would?

  • Meta-alias in Git Bash
  • How to setup Jenkins build with two separate repositories (poms)?
  • Push Laravel Applications without config information
  • git and removing files
  • USERAUTH fail using JGit to access git repo securely for PullCommand()
  • Organize a large Project with multi private cocoapods
  • 4 Solutions collect form web for “Git is ignoring .git directories in subdirectories”

    Don’t do it. It’s a bad idea because you are creating a versioned backup of a versioned repository. Just create a backup by rsync (you can still version the parent using git)

    I’m personally using git to sync some dot-files like .profile or .vimrc. To avoid problems like yours my git is located in $HOME/dot and the single files are symlinked in $HOME.

    I would recommend a script which would first backup every .git projects you have under your $HOME: it will produce one backup file (still under your $HOME)
    See git bundle for more.

    And then, you can add/update those backup (or “bundle”) files to your main git repo (which contains all of your $HOME except the .git projects)

    Finally, you can export all of your $HOME as one file with the same Git backup technique (git bundle).

    In the past I have used gibak, a Git backup tool. Besides taking care of file attributes it also takes care of Git repositories inside your home directory.

    One disclaimer though. I have used it for a while, but sometimes the backup became corrupt. I haven’t investigated this, but I suspect it has to do with the fact that running applications constantly write data to your home directory. At some point the hashes mismatch and you have to do some smart things in order to get it fixed (or start a new backup).

    At least give it a try, it may work for you. The problem I mentioned might also be caused by Git. Since I tried this 1.5 years ago, it might be fixed in the meantime.

    Git Baby is a git and github fan, let's start git clone.