Lots of companies do not put their code in public repositories, granted I understand the perspective of violating a license, but the point is if you don’t want your code used by someone else (even with the risk of not getting credit, don’t know why that matters) then don’t make your repo public period.
To that point, what’s to stop GitHub from making a policy that states: “All public repositories will be utilized in AI training”?