4

Let's say you have a parent project and submodule.

There is a user who has read/write permission to the parent project but only read permission for the submodule.

How do you stop the user from making a change to the submodule and committing it and then subsequently committing and pushing the updated reference to this new commit in the parent project?

The user will not be able to push their changes to the submodule as they do not have permission. When another user now pulls down the parent project they will have a reference to a submodule commit that has not been pushed up to the server.

Rupert
  • 1,629
  • 11
  • 23

1 Answers1

3

There are two solutions:

  1. tell your user to use the new --recurse-submodules=check option when pushing
  2. or set up a server-side hook that checks for the new submodule check, in this answer
Community
  • 1
  • 1
CharlesB
  • 86,532
  • 28
  • 194
  • 218
  • I don't think this is correct. This is from the git manual: "One common problem happens when a developer makes a change locally in a submodule but doesn’t push it to a public server. Then, they commit a pointer to that non-public state and push up the superproject. When other developers try to run git submodule update, the submodule system can’t find the commit that is referenced, because it exists only on the first developer’s system." – Rupert Mar 08 '13 at 15:07
  • 1
    Thanks CharlesB. This looks good. I'll check it out and likely accept this answer. – Rupert Mar 08 '13 at 15:18