In the case of github, they can and have taken down/blocked repos that foreign govt have found objectionable. So its not the odd offensive word here and there. Luckily, git makes it easy to have multiple copies of a repo lying around all over the place.
And yet they're hypocrites about that: they have instructions about how to circumvent the Chinese firewall on their site, which is clearly intended to have the Chinese break Chinese laws. It's not the fact they do censorship, it's the fact they measure with two measures (?) - yes to git and fuck, no to retard, yes to removing illegal stuff, no to respecting Chinese content laws, etc.