1

From the footer on all SE sites, user contributions are licensed as CC BY-SA 3.0:

site design / logo © 2018 Stack Exchange Inc; user contributions licensed under cc by-sa 3.0 with attribution required.

Whilst licensing it as CC BY-SA 3.0 I sometimes want to license my code as MIT, GPL or any other license. This would allow users to take the code from one of my posts under a license which isn't CC BY-SA and have more freedom with the code.

And so my question is how could you dual license code in a code block?


I think something like the following would work, but I'm not sure if it's ok:

The following codeblock is licensed under CC BY-SA 3.0 and GPLv2

print("Hello World")

2 Answers 2

2

Yes, you can do that, but the effect might not be exactly what you expect.

According to the Stack Exchange TOS:

You agree that all Subscriber Content that You contribute to the Network is perpetually and irrevocably licensed to Stack Exchange under the Creative Commons Attribution Share Alike license.

This says that you must license under CC-SA. Nothing prevents you from also licensing under something else.

However, if someone is getting information from Stack Exchange, they themselves must follow the TOS, and the TOS says:

In the event that You post or otherwise use Subscriber Content outside of the Network or Services, with the exception of content entirely created by You, You agree that You will follow the attribution rules of the Creative Commons Attribution Share Alike license as follows:

You will ensure that any such use of Subscriber Content visually displays or otherwise indicates the source of the Subscriber Content as coming from the Stack Exchange Network. This requirement is satisfied with a discreet text blurb, or some other unobtrusive but clear visual indication.
You will ensure that any such Internet use of Subscriber Content includes a hyperlink directly to the original question on the source site on the Network (e.g., https://stackoverflow.com/questions/12345)
You will ensure that any such use of Subscriber Content visually display or otherwise clearly indicate the author names for every question and answer so used.
You will ensure that any such Internet use of Subscriber Content Hyperlink each author name directly back to his or her user profile page on the source site on the Network (e.g., https://stackoverflow.com/users/12345/username), directly to the Stack Exchange domain, in standard HTML (i.e. not through a Tinyurl or other such indirect hyperlink, form of obfuscation or redirection), without any “nofollow” command or any other such means of avoiding detection by search engines, and visible even with JavaScript disabled.

To remain in compliance with site TOS, I think they'd still have to obey those rules if they get the code from your post, even if your alternate license allows otherwise. (Of course, if they get the code from somewhere else, they could ignore this.)

2
  • Yeah, the user could use the alternate license, so long as they followed these specific attribution rules, I think. (And even if they didn't follow those rules but did follow the alternate license, they'd only be guilty of a TOS violation and not copyright infringement, because they would have a license to use the material.)
    – D M
    Jan 26, 2018 at 17:43
  • The ToS no longer says that. Jul 26, 2019 at 17:25
0

According to the CC BY-SA 3.0 license text, you may only relicense the respective work in compliance with CC BY-SA 3.0. Accoring to the list of compatible licenses you may re-license your work e.g. under a newer version of BY-SA, e.g. CC BY-SA 4.0. The work then published under CC BY-SA 4.0 may be relicensed under the Free Art License 1.3 or GPLv3 as per the aforementioned list.

That means that you can not relicense your work posted on SE on any license not compatible with CC BY-SA 3.0 without violating it.
If you want to license your code using a not CC BY-SA 3.0 compatible license, you cannot do this on SE, but maybe your private website.
As soon as you publish your work on SE, it becomes subject to CC BY-SA 3.0 as per the TOS and any use of the work obtained from SE must comply with CC BY-SA 3.0.

3
  • I believe that it is simply not possible, since the TOS force the CC BY-SA license. Jan 26, 2018 at 16:08
  • [...] perpetually and irrevocably licensed to Stack Exchange [...] I think this does exclude that. But let's maybe wait for somebody else to either ack my POV or give another solution. I'm curious myself. Jan 26, 2018 at 16:16
  • 2
    "According to the CC BY-SA 3.0 license text, you may only relicense the respective work in compliance with CC BY-SA 3.0" - That only applies to people who are getting the work through that license. If it's your code, nothing says you can't also license it under some other license.
    – D M
    Jan 26, 2018 at 16:36

You must log in to answer this question.