how switching to an alternative like codeberg would prevent it? ti can be scraped as well
But on GitHub, you agree explicitly that MS can use it. I would assume codeberg has any-scraping measures (not saying they are perfect, but better than knowing Microsoft can train with private repos).
It's a losing game to try to keep any FOSS code completely isolated from large scraping data sets. All you can do is never share it, or share it and eventually it'll get consumed by the machine.
Spend your time making better software you and your friends can use... don't waste the time trying to stop others from making another painfully average codegen machine.
Quite a few commentors here mentioned using gitea or one of it's forks on a private tailnet. That would mean it isn't publicly available and can't be scraped.