I'm glad to see Fossil mentioned here. Yet the real problem is not in the technical aspects and possibilities of project hosting migration, it's the dependence of the majority of open-source developers on GitHub's centralized social network.
This makes me wonder how hard it is to securely host a git server on my own. I'll start googling but I bet the answer is gonna be "hard."
1. Running git.
2. Providing SSH access.
But even securing the server is not necessarily difficult, depending on the level of risk acceptable for your purposes.
Put another way, reasonable security is not too hard and AWS makes reasonable security fairly easy. Even self-hosted *nix servers can be pretty secure. However to seriously harden a service against skilled and determined attackers requires an experienced team and even that may not be enough.