While using github for source code is generally something I love to encourage, if a student puts their (computer science) homework there, it's generally easy for others to find and copy - which creates a temptation to use it as a "baseline" for their own (identical in most cases) homework - while I understand the benefits of using github (versioning, transitioning across machines easily, teamwork-capabilities), and the individual student who is using it has verified that it is indeed their account and can explain the code well, I still feel uncomfortable with it.

Has anyone else dealt with this issue? how did you handle it? does the university have some sort of policy around publishing student-created work openly? (even if it is part of an assignment)?

As a side-note, my general policy regarding "very similar" assignments is that whomever submitted it first gets the points, and the other submissions do not receive any points, however I tend to ask the students to explain their code and how it works, why they chose X over Y, etc. in such cases first.

edit: I have been informed that there does exist a free version of github that students can use to host private repositories, and this is likely the course of action I will go with for the near future, however, there are several drawbacks:

  1. The student will be unable to showcase their work (i.e. a link to their github on their resume)
  2. The student will not be a student forever, and thus the repository won't be able to be private for free indefinitely
  3. I have very little control (and interest in policing it) once the class is over, so the student could decide to make the repository public once the class is over.
  • 6
    Bitbucket is free. Commented Dec 12, 2014 at 4:38
  • 10
    GitHub private repositories are free for students: github.com/edu . As a teacher, you might also be able to get stuff. They call it "Request a discount", but for students the deal is "Micro account (normally $7/month) with five private repositories while you're a student"
    – yakatz
    Commented Dec 12, 2014 at 4:44
  • 2
    Do note that Github takes forever to process a education account. Commented Dec 12, 2014 at 5:02
  • 6
    What about a local git repository? If you want cloud backup, you could use it together with dropbox etc.
    – RJ-
    Commented Dec 12, 2014 at 5:27
  • 2
    To be frank, points 2 and 3 you have absolutely no control over anyway. The easiest thing to do would be to subtly change the assignment so that "last year's solution" doesn't work.
    – Fomite
    Commented Dec 12, 2014 at 14:39

8 Answers 8


Give students assignments where their work must address one of their personal interests. For example, instead of having every student program pizza maker, have each student program a machine to make their favorite food. This will make copy-and-paste cheating more difficult. It will also make students more interested and make your grading more interesting.

  • 12
    Makes it a lot harder on the autograder Commented Dec 13, 2014 at 4:51
  • 3
    @user2813274 Providing individualized feedback will help student learn more, so it is worth it. Commented Dec 13, 2014 at 17:19
  • @user2813274: What exactly is that? I'm not a computer scientist, but I code for fun. Does it somehow access the complexity of the code?
    – JNS
    Commented Dec 13, 2014 at 21:39
  • 1
    @user1997744 an autograder is a site where students can upload their code, have it executed, and give feedback if it passes/fails - basically the same as a unit test case, however I can keep the test cases hidden from the students such that they don't code against specific scenarios and miss the general solution. Commented Dec 14, 2014 at 3:50
  • 2
    @user1997744 the auto-grader is an optional tool for the students to use before turning in an assignment (although it correlates quite well as to how they do typically..) Commented Dec 14, 2014 at 22:48

I think your point 1 is fundamentally at odds with preventing homework sharing/copying. If someone can showcase their work, they can showcase it to their fellow students. Your points 2 and 3 suggest you want to re-use the same assignment over and over when teaching the class again, which makes this conflict even more inevitable. There's no way to allow students to share their work publically with anyone who might want to employ them, while also keeping it secret from their fellow students.

There's nothing you can do to keep everything a student does in your class hidden forever. I think the best solution is to require students to keep their work private during the class (using a Github edu account, Bitbucket, local git repo, whatever), then let them do whatever they want later. That means you will have to make new assignments every time you teach the class, but I think that is good practice anyway.


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.

Another thing to consider: at my undergraduate university, there was no department-wide policy on public version control (and I don't remember any professors having such a policy). However, I remember hearing it suggested that posting code on a public GitHub violated the general policy against plagiarism. This sort of ambiguity is bad for everyone. Whatever you decide is the right way to go, I would recommend stating your expectations explicitly with respect to public version control.


It seems one point that is missing in this discussion is that at least in USA students own the copyright of their (nontrivial) work. As copyright holders they can reproduce, distribute, and display their works. Of course they can also create derivative works. So restriction on students' right may not even be legal.

  • 1
    Copyright requires that a certain "threshold of originality" is exceeded. A solution to a simple programming task may not be original enough to warrant copyright. Commented May 11, 2020 at 11:39
  • If a solution to a simple programming task isn't sufficiently original to merit copyright, it's probably not sufficiently original that this student posting their work matters in the grant scheme of things -- solutions to simple programming tasks like that are readily available online.
    – Sparksbet
    Commented Jun 29, 2020 at 23:08

My focus on programming assignments has moved to having students copy all they want from all the GitHub repositories in the world, but to reference them in a report about the process by which they solved the problem, written in complete sentences. This is seen as cruel and unusual punishment by first-year students, but when former students meet me in town after graduation that is what they thank me for, that I taught them to write reports. And that their reports make a great reference for themselves.

We can't police this behavior, so we have to try and educate people. We teach them to value other people's work by citing it or giving credit, and we insist that they reflect on what they did. So it is fine to say: I got this code from Nancy, and then I asked Steve how to put widgets on this, and as a result I finally got this to work. That makes it easier for me to judge what the contribution of the student is.

It is more work for me, so I have gone to having the students do pair programming, assigning them random partners each week. That's a good exercise for them as well, and they get to know each other better.


You may try automated plagiarism detection, such as MOSS developed by Stanford. It detects similarities among code files, somewhat regardless of how the variables are named, the order of execution, etc. Then a human could manually look at the similarities and judge whether it is a case of plagiarism. Moreover, as I recall, MOSS allows input of shared codebase, meaning that the "starter code" provided to all students would not count towards similarity.

  • 2
    It "tries" to detect plagiarism. There are a few other programs out there, but none actually detect all plagiarism. Commented May 11, 2020 at 21:15

The optimal solution is to accompany the automatic code grading with a human face-to-face code-review, where the students must explain their code to you, and you can also ask them to make minor changes onlile to verify that they know what they did. If you do this, you do not have to worry about copying since the code-review will tell you how well they know the material.

The problem is that this solution requires a lot of work - at least 15 minutes per student per week. I do not have enough budget for this, so I use a sub-optimal solution: I make the weekly assignments only 10%-20% of the final grade, so that the incentive to copy is minimal. Meanwhile, I make sure that the final exam contains questions that are very similar to the assignments. Thus, students who have made the homework by themselves will have a higher grade in the final exam than copiers.


Ignore it.

It is homework and not an exam. The students who just use it without understanding it risk to fail the exam and that's their problem not yours. They are all grownups and need to decide themself if they want to learn something or just to copy something.

As homework usually does not influence the final grade but only the admission to the exam, it is not worth to try to prevent it.

And github is one thing, but students have internal fileservers and wikis and other ways to organize how to exchange current homework or even a complete set of assignments from last year.

Make sure that everything that gets an actually relevant grade is not done without supervision and be a bit more relaxed about homework that should just help the students to learn and is not used to document their skill like a graded exam.

If you actually see that the code is copied between two students, you may not accept it. But this should be done by comparing their solutions not by monitoring github. They may copy in private or they may have worked together and you need to decide it based on the submission of their work.

When they are actually able to re-use code from the previous year, you may consider changing the assigments in a way that the code cannot be used without at least understanding it.

  • I hear chem students in the library talking about cheating their final exams like they cheated the second exam. These people are going to fail Chem 2 hard; they won't make it through Orgo. At a point, you know so little about the topic you can't even figure out how to cheat.
    – John Moser
    Commented Dec 15, 2023 at 14:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .