There are many things to balance here, and the "best" solution is somewhat subjective.

However, in my opinion, the educational benefit of allowing students to learn version control early **far outweigh** the increased risk of exposing their code to others who would cheat. If your students are planning to go on to work as programmers in industry, being skilled with version control is almost as valuable as being skilled with coding. Programming is not a solitary task these days, after all.