Re: "GitHub [..] has apologized for the error in its code"
I assume that the software licence says that they aren't liable for anything that happens. Inexcusable or not. These are the conditions that we accept.
Having said that, I don't understand the technology, but it seems that it would be a good idea for the function that goes "Upload the project to the repository" to have a feature that goes "Don't upload that part of the project to the repository".
As long as that worked, of course.