Do github ban users for commiting bad repositories just like stackoverflow for asking bad questions?

Define bad. If by bad you mean low quality, no. They don’t care- github is an acceptable place to use while you learn. You can also use private repos to not share the code if you wish.

If by bad you mean possibly illegal (virus, ransomware, etc) they do have an Acceptable Use Policy and could choose to ban you for violating that. Here’s a copy of it https://docs.github.com/en/github/site-policy/github-acceptable-use-policies