Can I put a .gitmodules file in a subdirectory?

Let’s say my repo index root is in /project dir.
Should the .gitmodules also be inside this dir, or can I put it into, say /project/subdir?

The reason I would like to do that is because I have multiple contributors and I want each to be responsible for his own set of submodules.

  • Version Control for Homework Assignments
  • How to solve TortoiseGitPlink Fatal Error?
  • Hg-git stopped working for multiple branches
  • Handling file renames in git
  • Producing git diff for new untracked files
  • Copy git repository to offline machine and pushing/pulling via memory-stick
  • Is there a way to force the creation of a remote repository?
  • Configuring Eclipse / EGit to track an upstream repository
  • How do I add a remote Git repository to an Ubuntu Server?
  • What's the best way to deploy multiple projects to a server with Git?
  • Error: “git” command line tool is not installed:
  • git commit can't find (global) config running in cron job
  • One Solution collect form web for “Can I put a .gitmodules file in a subdirectory?”

    man gitsubmodule on Debian Wheezy says:


    According this default place for .gitmodules file is a top-level directory of the git working tree.
    So, lets say you have such project structure:

    |  `--.gitmodules
    |  `--.gitmodules

    .gitmodules in your project root dir will define modules subproject-1 and subproject-2. Subprojects dependent modules also can be defined with subproject-N/.gitmodules, but those settings will affect only in proper subproject scope.

    To update your project dependencies you should use command:

    git submodule update

    But if you want to update also dependencies of subproject-1 and subproject-2 use:

    git submoudle update --recursive
    Git Baby is a git and github fan, let's start git clone.