views:

165

answers:

3

I'm teaching a new course at a new University this semester, and I'm really interested in getting my students up and running using Best Practices. In this manner, I'd like to assign and receive homework from them using git repositories. Unfortunately, I use git, but I don't understand it well enough to know what the potential security holes are and how to avoid them. Also, I've only used git for personal version control, and never in a group or team.

My current plan is to set up machine A with users 1-12, corresponding to each of my students. I will generate an ssh public/private key pair for each student, and an initial git repository as well. The students can then access the repository for new assignments and push to it when they are submitting.

Ideally, without too much trouble, I will be able to push from a master repository into the student repositories when I am giving assignments. If it would be possible to pull from their repositories into the master repository that would be neat as well.

Edit: This text was a little unclear. I intend for them to push/pull into their individual repository when they complete an assignment or are given a new one. I don't presume that I'll be able to push assignments into their laptops :)

So where do I start? What do I look out for? Is this a bad idea? If so, why?

+2  A: 

For you to push into their repositories (that are owned by their user) implies that you need to use root privilege in order to push into their own. Why not publish the path to the assignment and have them pull it?

Of course, you can also restrict ssh keys so that only a given command may be run; you could perhaps restrict the paths in a single repo owned by a single user based on the key provided.

Git is a DCVS, so I like your multiple accounts idea.

wrang-wrang
"For you to push into their repositories (that are owned by their user) implies that you need to use root privilege in order to push into their own."I am hoping that I can get around this by adding myself to the group of each student. Of course, I have no qualms with using sudo in this case :)
Aron Ahmadia
Yeah, maybe just forcing their umask to 002 would do the trick (making their created files group writable).
wrang-wrang
`git init` has a `--shared` option for just this situation. Git will set up the group access bits in the repository to something that makes sense (for the group).
Greg Hewgill
+2  A: 

If you use Git, your students will have to learn a lot of concepts relating to software configuration management, version control, etc. which is unnecessary for teaching, say, a Geography course. Are you teaching an SCM course? If so, your idea sounds good. If not, you could consider something like Moodle. If your users are on Windows, remember that Git is not at its best in that environment.

Vinay Sajip
I agree, you should really make sure they master the tool, so they don't lose data, etc. So you need to spend a few hours to teach first VCS/DVCS basics, then git specifics (reflog, index, etc.).
tonfa
This could be a deal-breaker. Although the class is being taught at a graduate level to students with an undergraduate computer science background, there won't be any course material on version control. I'm hoping that they can use VERY basic git add/commit/push to turn in their assignments. I might be able to allocate an hour in a laboratory to get them familiar with git, but no more.
Aron Ahmadia
+3  A: 

You can use Gitosis to manage SSH access to repositories, as described in scie.nti.st: Hosting Git repositories, The Easy (and Secure) Way and Tv's cobweb: Snakepit and gitosis, things I've been working on blog posts, and in Chapter 4.7: Gitosis of "Pro Git: professional version control" book. It is in Python, and requires setuptools. Or you can try to find its equivalent, like gitolite (formerly gitosis-lite) in Perl.

Alternate solution would be for each of students to have its own repository, or pair of repositories: private one he/she is working in, and (semi)public one perhaps with SSH access he/she pushes to complete finished work. You would act the role of maintainer / integrator, and pull changes from their public repositories into your repository (or your repositories). Students would pull from your public repository (or repositories).

Jakub Narębski
Thanks Jakub. Do you recommend gitosis or user accounts for maintaining the separate repositories? Both seem like viable options and I'm not sure which will be easier and more secure.
Aron Ahmadia
I have not got the need to set up multi-user git repositories, so I cannot tell you that; I have no personal experience with such setup. I'd recommend reading relevant chapters of "Pro Git" (and perhaps also "Git User's Manual" and "Git Community Book").
Jakub Narębski
gitosis is a quite comfortable solution to manage git repositories and user access. You can manage all repositories and access permissions through 1 config file. I've been using gitosis for about a year now and management and usage is really straightforward. It's definitely worth a look.
Mathias