The solution is probably to self host git and sync an encrypted incremental backup to many clouds... I don't code much though
That said, github has features like review, comparison, user management, that obviously you wouldn't have if you just self-hosted.