I have to wonder if those posting solutions on github are actually doing it in an effort to cheat. I made a similar mistake recently with a project I completed in my computer architecture course. When the professor contacted me about it, it seemed obvious. But at the time, all I was thinking about was "yay, public code!" Obviously, I took it down right away. I wonder how many people are doing the same thing. Cheating…
If it's your work, you own the copyright, and it's totally within your rights to make it publicly available.
That's like using free speech as a motivation to tell your boss to "Go fuck himself"