Is the code snippet posted in github repository issues section automatically under the same license that the repository is having?

Additionally(and related), is the content in pull request which has not been merged still under the same license of the repository. (The PR may end up never been merged, yet others can often see all the content of the PR).

1 Answer 1


Github's ToS codify the inbound=outbound license principle: contributions to a repository can be assumed to be under the repository's license. However:

  • The repository needs to have an obvious license.
  • The user must have intended for their contributions to be included into the repository, for example by creating a pull request and/or uploading their changes under that license to their fork of the repository.
  • This cannot apply retroactively: what is relevant is the license at the time the pull request was made, not the current license of the repository. If in doubt, check out the commit in question and inspect the tree for any license notices.

Whether issue comments are a contribution in this sense is more tricky, because an issue creator might not have intended to have their issues included under the repository licensed. I would argue that a repository license cannot extend to issues. To determine the license status of a code snippet, you would have to look at context. If it is intended as a contribution, then this may be fine. But in the general case you should assume that all rights are reserved.

There's also the question whether short code snippets are copyrightable at all: copyrightable works must meet some threshold of creativity to be eligible for protection. This threshold is not clear: there is no fixed number of lines before copyright starts to apply. Typo corrections, small fixes, modifications of existing code, and representations of facts can often indicate that these snippets are not copyrightable. For example, a minimal test case to reproduce some bug might not be a creative work but a fact, and therefore ineligible for copyright protection. But again: it's important to look at the context.

  • +1 from me, though I'd take issue with your argument that the repo licence cannot be presumed to extend to issues.
    – MadHatter
    Feb 3, 2019 at 12:44
  • @amon, Thanks! So based on your argument, for the case where a pull request that has never been merged (for various reasons), can be considered as "intended for their contributions". So even if it has not been merged and not end up in the final repository, its code can be used under the license. In my case, the repository has a clear license (Apache-2.0) and to the best of my knowledge, it has always been like that. Feb 4, 2019 at 3:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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