What I need to do is blogging about my own code. I already use github for my experiments and release code usually on GPL3. My wish is to write blog pages with code snippets from the GPL3 projects. Like so: write my thoughts/experiments and raw code examples on the post and then release the final result on github as GPL3.

What license should I use for my blog posts? I'd like to use one of the Creative Commons license (favouring CC Attribution). I know CC Share Alike v4 is compatible with GPL3 but I don't understand if it is so in my particular case. I own the copyright to all the code I might put in the blog posts.


(1) If you hold the copyright to the GPL code, then you are not bound by the GPL license. You are free to also license that code snippet under CC-BY-whatever (dual-licensing). No formal mechanisms are needed, you can just write your blog post with the code snippets.

(2) If you do not hold the copyright, then you have to abide by the GPL license. The GPL does not allow you to publish that code snippet under a different license. Instead, you would have to:

  • link the GPL code rather than including it into your blog post; or
  • rely on a copyright exception so that the GPL or any other license would be irrelevant for your use (e.g. fair use in the U.S.; I'm not familiar with Italian exceptions)

Quoting a snippet from your own projects seems perfectly fine (case 1). If those snippet include other people's GPL-covered code then you are bound by that license (case 2).

So why are CC-BY-SA 4.0 and GPLv3 considered compatible? Because the CC-BY-SA has a compatibility mechanism in the other direction: you can take something for which you received a CC-BY-SA license and use it under the terms of the GPLv3 instead. This is a one-way street and doesn't help you in this case. For CC-BY no special compatibility mechanism is needed because CC-BY is not a copyleft license, but CC-BY → GPL is a one-way street as well.

  • For #2, do you have to do bullet point 1 or bullet point 2, or bullet point 1 and bullet point 2?
    – user15191
    Jun 13 '19 at 13:47
  • @TylerGubala Or. Clarified. Thank you!
    – amon
    Jun 13 '19 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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