This is misguided. What you want is adding a special clause to your license that disallows usage for training LLMs. Whether the code is on GitHub or not, it’ll be used to train models if it’s publicly available and the license allows it.
So? Maybe making so much code open source without any restrictions was a mistake in the first place. I know that I don’t want trillion dollars megacorps benefiting from my free open source code in any way. That would include LLM training.
The contents of the license are irrelevant, because such training is not being done under that license at all (or else it would already be violating it, failing attribution at the least—and it seems likely to be fundamentally impossible to comply, just like a human could not comply if human learning was subject to such licenses). It’s depending upon copyright restrictions not applying to it (under “fair use” doctrine).