9

I have a doubt related to licensing, which is something I clearly don't master.

Let's say I've posted code created by me on Stack Overflow, which gets automatically licensed in CC-BY-SA.

Users should then refer to the site and to the author as the source of the code (Jeff Atwood said also to the user's profile, but that's overkill, especially due to answers edited by multiple authors).

Now, let's say I'm building something on GitHub I want to release as MIT License, and including the code I created and posted on StackOverflow previously.

Can I do that? Provided that I link back to the original Stack Overflow answer from the GitHub file, can I relicense the code snippet under the new license?

Or can/should I license only that file under CC-BY-SA and the rest of the files under MIT License?

How is this (common, I suppose) contamination between GitHub and Stack Overflow supposed to be handled?

1 Answer 1

11

Licenses are for other people. If you own it (all of it, so code collaboratively developed here can only be used under the terms of the license) then you can do whatever you want with it. This includes publishing it somewhere else under any license you like.

6
  • @Andrea Yes, I am completely sure. Users always give a non exclusive license to Stack Exchange. Apr 10, 2018 at 13:48
  • @AndreaLigios you're the original author, you own all rights. I own the Rubberduck repository (GPLv3), and the 77 questions tagged [rubberduck] on Code Review agree with this answer =) Apr 10, 2018 at 13:48
  • 4
    @AndreaLigios You can't revoke a licence you have granted (unless that licence has terms that allow it to be revoked). You can add whatever licences you want. Other people are then free to do whatever any of the licences you've granted give them permission to do. Licences, by definition, only ever give others permission to do more things, they don't ever take away anything (from anyone else; they take away rights from you, as the owner, because you've now allowed other people to do things that previously only you could do).
    – Servy
    Apr 10, 2018 at 13:48
  • @Servy, your comment should be the accepted answer. Thanks to everybody Apr 10, 2018 at 13:51
  • 1
    Somewhere on MSE there is a post from, I think, Jaydies (or maybe Tim Post) that says approximately: "we never intended to limit your rights to your own work and have fixed the TOS to be more clear". You, as the owner, can do whatever you want with your code (so long as it's fully yours, as this answer says). In addition, you grant an irrevocable CC-BY-SA license to others by posting it on SE. Apr 10, 2018 at 14:57
  • 1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .