I’m a fairly new Git and GitHub user. I teach an AP Computer Science A class and I’d like to start integrating git and github into my class. I think i’m going to use GitHub Classroom for lab assignments, and I understand how that will work. But, I have another problem.
I want to use a repo in my organization to hold code which I use during our “notes” days. The organization i’m using is the one GitHub Classroom is also using (if that matters). This code is just for demonstration purposes and I want students to be able to mess around with it locally, but I don’t want them to be able to push their changes back to the repo. Ideally I think I want a day to look like this:
- before class I finish my code for the day and commit changes/push to the remote organization repo named Notes.
- Students get into the habit of logging in to computers and immediately doing a git pull of that remote repo at the beginning of class
- we have class … and even if students commit their changes and then TRY to push (even if I tell them not to), I’d like it to not work.
I though the solution was to turn on branch protections in the Organization Settings, and I thought the exact setting which would stop this was Restrict Who Can Push to Matching Branches… But I enabled that and I added only my account, then I tested it with a second unconnected account and that second account can still push changes to the master branch of my Notes repo.
How do I fix this?