Well, the best thing to do is the same as always: talk to your teacher about it! Most of them want to help you! Make it clear that you'll take it down if it's a problem, and explain to him or her why you do it. It's the safest route.
If he doesn't like it, consider paying for Github if you can. Then you can have private repositories, and you'll be supporting a great service!