tl;dr: check out Gitnonymous.
You can probably understand why somebody would want a private git instance. Maybe they have company secrets on there, or they just don't like the idea of a Microsoft owned company peering into their codebases at will. Less clear is why somebody would want anonymity or pseudonymity when making git commits.
The most common reason would be people who develop contraversial software. This could be software which annoys big businesses for example. A live-streaming torrent app might annoy media companies. Drivers and code that liberate proprietary hardware might annoy tech companies. This is why they created the DMCA.
It could also be software which annoys even more powerful actors, like states. You only have to look back as far as the 90s and the "cryptowars" for an example of this. The US government put export controls on encryption - they treated it as a munition! That's what prompted Phil Zimmerman to distribute the PGP cryptosystem on the Internet in 1991. Once the cat was out of the bag it was unstoppable.
Today some totalitarian regimes also want to stop developers from building software that might undermine their authority or power.
If you're looking for a way to make commits to public GitHub repositories without revealing your real identity, you might take a look at Gitnonymous. It's a shell script which can help you set up pseudonymous identities to interact with git repositories.
Take care and happy hacking.