Git is pretty simple to host yourself. For literally decades I've used git and gitolite to host git for me and a revolving team of developers.
But if you want it to be public though where anyone can access/fork it then you have to deal with "spam".
But if you want it to be public though where anyone can access/fork it then you have to deal with "spam".
Yes; it's not only possible but very common: https://docs.github.com/en/get-started/git-basics/about-remo...
(IIRC it is in fact actually even sometimes preferable from a security standpoint; or at least that's the tentative conclusion I've reached under a few specific circumstances over the years, although the exact details elude my memory at the moment.)