Obviously, someone must buy the paper, reproduce it, compare with original work, and then publish result for free. Same thing as for free software: someone must by a computer, write a software, then publish it on github.
Publishing it on GitHub is optional; you can publish it anywhere accessible. And unlike these journals, it doesn't cost you anything to access free software. In fact, paywalling it makes it unfree.