title: Best workflow for gitlab management of exercices for student
body: <p><strong>TLDR;</strong> The goal is to maintain two codes (if possible on one repo, if not on two), one that contains exercises and one that contains also the correction, by avoiding duplicating code as much as possible. The normal users should not be able to read the corrected code. Any trick is welcome.</p>
  
  <p><strong>Long version:</strong></p>
  
  <p>I'm trying to do the following things: the idea is that we are a few "teachers", and we are working on some programming exercises for our students. Usually we have 3 kinds of "resources" :</p>
  
  <ol>
  <li>resources that the students have access to but should not in theory modify (like libraries, assets, tests that will be run by CI...)</li>
  <li>resources that the students should modify, like a skeleton of an application</li>
  <li>resources that should not be readable to students, usually the correction of the exercise</li>
  </ol>
  
  <p>What we do so far is that we have two repos, one private for the teachers (with correction), and one public for the students, then the students forks the public channel into a private one, add the teachers as maintainers, and work from here.</p>
  
  <p>However, it's a bit annoying to have code duplicated between two repositories. Is there any smarter option that git (or more specifically gitlab as it's the tool that we use, we are using CI for testing automatically the code of the students) could provide to let us protect some files from being read/clone? Or is there any other way to maintain easily two repositories that differ just by one file?</p>