1

If I want to put random source code snippets in a publicly accessible git repository, does it make sense to license by CC-BY(-SA) given that CC-BY licenses are generally not recommended for software? To me there is a difference between a full software project where CC-BY clearly isn't appropriate and small random source code files. CC-BY seems like a simple license where GPL is over the top.

The main reason that I ask is that I may take code from StackOverflow (modified or not) which I believe is licensed as CC-BY-SA. Sometimes it would be convenient for me to put it all in one place so I can easily access and find it in the future. While I may be being overly-paranoid, I would like to adhere to the StackExchange CC-BY-SA license. Licensing everything I put there as CC-BY-SA is simple and seems appropriate for snippets (of course code taken from other sources, say with GPL/BSD or whatever will retain their original license if required).

Finally can I combine CC-BY-SA with GPL?

7
  • "Finally can I combine CC-BY-SA with GPL?" - no and more info about it for future GPL versions.
    – user40980
    Commented Aug 14, 2014 at 15:17
  • 2
    The only question I see here is the last sentence, and the answer is almost certainly "probably not in the way you have in mind." Commented Aug 14, 2014 at 15:21
  • Thanks @MichaelT, I thought so, but thanks for the links. At the end of the second link it also states that Several online communities, such as Wikipedia and Stack Overflow, have CC-BY-SA-licensed text. Many articles/posts on those sites contain computer code. GPL compatibility would allow sharing between these sites and GPL-licensed software. For example, code from Stack Overflow could be directly incorporated into open-source software, and GPL code could be used as examples on those sites. So that would seem to suggest that I could just GPL everything and be within both CC-BY-SA and GPL.
    – zelanix
    Commented Aug 14, 2014 at 15:28
  • 1
    @RobertHarvey I have updated the first paragraph slightly to clarify my question. I think that my main concern is the use of StackExchange code in this context (I want to stay within the CC-BY-SA license) and that CC-BY is generally not considered appropriate for software.
    – zelanix
    Commented Aug 14, 2014 at 15:39
  • 1
    @RobertHarvey, I think that's it. Why is CC-BY not generally considered appropriate for software and could it be considered appropriate under the circumstances detailed above?
    – zelanix
    Commented Aug 14, 2014 at 16:27

1 Answer 1

2

Lets take the last aspect of the question first:

Can I combine CC-BY-SA with GPL?

The simple answer there is no.

At GNU.org they have a list of licenses and their compatibility with the GPL at Various Licenses and Comments about Them #CCBYSA

This has a yellow dotted line to the side of it indicating that it is not GPL compatible.

This is a copyleft free license that is good for artistic and entertainment works, and educational works. Please don't use it for software or documentation, since it is incompatible with the GNU GPL and with the GNU FDL.

Creative commons is aware of this and there is some discussion and thoughts about this at GPL compatibility use cases on their wiki. They may attempt to make it compatible with the next version of CC-BY-SA (that would be 4.0).


The question is what is your goal for sharing those snippets? Do you want people to use them? or do you want to impose a given license. CC-BY-SA is one extreme (that notes the issue of software) and GPL is a copyleft that imposes its license on everything else in the project.

There are many licenses that are middle grounds in this that are very permissive and are GPL compatible. Going to the Software Licenses section of the various licenses and comments document, one just needs to scroll down a bit past the GPL/GNU ones and you find:

  • Apache License
  • Artistic License
  • Modified BSD
  • Mozilla Public License
  • X11 (MIT) license

and many more. The ones I listed are particularly well known in the community and are the ones that are least likely to cause problems with people trying to read them to make sure they are compatible with other licenses.


The licensing and copyright for code posted on Stack Exchange was brought up some time ago on Meta.StackOverflow (its now on Meta.StackExchange) with the FAQ question: Do I have to worry about copyright issues for code posted on Stack Overflow? and note that much of this delves into the real of legal where you start needing a lawyer.

This does point out the inherit issues of mixing CC-BY-SA which is intended for wiki type answers (such as what I'm writing) and source code.

7
  • Thank you for the detailed answer. I usually use BSD since I don't actually care what anyone might want to do with any of my code that I post online. It's really the question of StackExchange code that's not mine that I'm interested in here. I have read that meta post thread and that's really what triggered me to ask here. Basically, what should I use to keep within the SE CC-BY-SA license so that no-one can complain later? The Creative Commons GPL compatibility use cases page does seem to suggest that GPL is fine from the second-last section. Thanks again for your time.
    – zelanix
    Commented Aug 14, 2014 at 16:08
  • @zelanix you should follow the CC-BY-SA license (and the associated attribution back to the answer). If someone happens to incorporate the code into a product with a conflicting license, then that's an issue for the person who holds the copyright to address. My guess is that they won't mind... but that is not backed up by any data. If they are concerned about it, they can always ask the person who wrote it for a dual license that is compatible with what they are releasing.
    – user40980
    Commented Aug 14, 2014 at 16:12
  • So I should then release under CC-BY-SA since that's required by the license? I do currently include the main This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License and credit the answer and user in the header of the file. This would seem to keep me within the CC-BY-SA license. But why is it generally not recommended to use CC-BY for software?
    – zelanix
    Commented Aug 14, 2014 at 16:31
  • 1
    The CC licenses in general aren't designed for working with source code. They are intended for complete works of literature or visual arts which can stand on their own as a work. But they say nothing of warranties for software, patent grants, the ability to fix bugs in the code and re-release it... or even if you can compile the code and redistribute that. Note that CC even recommends against using a CC license for software.
    – user40980
    Commented Aug 14, 2014 at 16:38
  • 1
    @zelanix its a very very gray area that I'm sure is done all the time with material from SO and no one is looking too hard at fixing it.
    – user40980
    Commented Aug 14, 2014 at 16:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.