Technically, they don't. They have control over US-based companies like Microsoft, in the sense companies have to abide by the laws that prevent them to do any kind of business with embargoed countries. GitHub happened to be in the line of fire.
It's a grim game of international politics and I don't want to dive into that. But, as I said, it's a two-way route, as GitHub has been often blocked over local censorship laws. Not to mention Twitter, Facebook, Whatsapp, Telegram, Youtube, etc.
I'm sure you're aware of that. The point is that the community is affected, but not out of options. As other mentioned, there are alternatives - although not as good, I'm afraid 😟
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.