I am designing a public code repository. Users will be allowed to post and edit whatever amount of code they want, from code snippets to entire multi-file projects. I have a few major legal concerns about this:Not getting sued/shut down - I feel the site would be a much easier target than tracking down an individual user to sue. I have looked around a bit and see links to legal info in the footer of each page is common. What specific things should I do--and what does does a site such as YouTube (which I see copyrighted material on all the time) do--for protection?Citing sources and editing sourced code - If a user wants to post code that isn't theirs, what concerns/safeguards should I have? Will a link suffice, and what do I need further to allow the code to be edited (to improve it for example)? What can happen if a user posts copyrighted code without citing it?Large chunks of code - What legal differences should I look out for as the amount grows?Not having a mess of licenses for the site - I would like to have a single license (like RosettaCode) that keeps things simple for interaction on the site. I want the code to be postable and editable. I have looked into StackOverflow's CreativeCommons license a little and it says thatIf you alter, transform, or build upon this work, you may distribute  the resulting work only under the same or similar license to this one.And on RosettaCode:All software found on Rosetta Code should be considered potentially  hazardous. Use at your own risk. Be aware that all code on Rosetta  Code is under the GNU Free Documentation License, as are any edits  made by contributors. See Rosetta Code:Copyrights for details.What other licenses are like this?Commercializing the site - In what ways can I and can't I make money off of a site that contains code like this? All code will be publicly visible. Initial thoughts are having ads or making money by charging for advanced features.
Copyrights concerning code snippets and larger amounts of code
legal;copyright;code snippets