In a communist society then the governemt would take ownership of all code (of factories). That's not Stallmans idea.
Saying that 'socialism == sharing' is too simple.
Example: programmers who work at Microsoft don't own the source code and can't use it for their own benefit, while Microsoft makes money from it and only pays wages, which are below the value of source code to the company. This is the old model of Capitalism.
Open Source is very much a Communist idea. People who work on open source, even if they are payed for it, still have access to their work and can use it independently of the company.
On the other hand, given the terrible outcomes communism produced in the 20th century, it has a well-deserved bad reputation. I'd therefore hesitate to link it to open source without noting why open source is different: Code, once written, can be copied infinitely for free (or at a very low cost), so the model can work.
Thanks for a thought-provoking post.
For all their talk about the importance of using a distributed version control system, they've managed to pretty heavily centralize themselves on GitHub.