Search code examples
gitgit-submodules

Enforce --recurse-submodules=on-demand for all clones of a repo


Given a Git repository with several submodules.
Is there a way to enforce all clients (read clones) of that repository to use the --recurse-submodules=on-demand option on pushing commits? I don't want to have the users manually add that flag to each git push.

Beside that, I will also set up an update hook on the server to enforce this policy, but that alone would make the users have to enter --recurse-submodules=on-demand each time they push commits.


Solution

  • Not yet: the config "push.recurseSubmodules" proposed in that patch didn't make it through.
    Even if it had, that would mean each user need to configure his/her clone.

    The only other solution is to define an alias (as in "git - default push to --recurse-submodules=check").
    Again, this is a per-user solution (no easy way to propagate that setting from one central repo to all its clone).