Unlike forum comments, GitHub code generally has an explicit license attached which you'd have to respect - you know, for instance by giving attribution to every MIT-licensed source that was used.
And even then, let's say someone releases a book with all your HN comments: you are definitely entitled to sue them for copyright. Here's some info from the BBS era, which is still relevant today: https://www.templetons.com/brad/copymyths.html