5

When I add a license to a project, I usually place it in a file LICENSE.md at the root of my repository.

Now, I thought I'd add the license right there in the README.md and not add a LICENSE.md file to my project.

Can I just do that? Is it unusual?

1
  • What's so bad about having the license in its own file?
    – chicks
    Jan 21 '19 at 22:21
8

You can absolutely do that and it is fairly common. A file called LICENSE has no special legal significance. It is the responsibility of a user of the software to obtain necessary licenses, so the absence of a particular file doesn't give them any special permissions – if they don't find the license in the Readme, they cannot use the software.

Actually, many projects do not have a license in their LICENSE file, but only the license terms. There should also be some specific notice that the software can be used under those terms. Other projects have neither a license file nor a license in their Readme, but only a license identifier in package metadata. While it is usually clear what the author intended, I do not think that would be a suitable license because it's too easy to accidentally put into the metadata, e.g. as part of a template.

It may be desirable to also put a license header into all of your source files so that it is clear that they are part of the project, and that they are subject to a particular license. This can help if the source files are copied without the README, which can e.g. happen during some packaging processes or by a careless fork.

Some special file names such as LICENSE may be used by GitHub to auto-detect the repository license. If you put the license into the Readme, GH will no longer be able to recognize that. Then again, this GH license indicator is quite fragile anyway and users should not rely on it but always check the actual license.

3
  • I would in an edit emphasize that, Technically speaking, licenses like MIT require including the license-text ("permission notice") with the software, so if a product only mentions "is available under the MIT license" without actual permission-notice, technically it's not correctly MIT-licensed yet (if we can't find the exact permission-notice anywhere with the software).
    – Top-Master
    Jul 28 at 10:25
  • @Top-Master Please please please stop spamming me. You have made your point dozens of times in the last few days.
    – amon
    Jul 28 at 10:42
  • ¯\_(ツ)_/¯ Hmm... one single comment can not be considered spamming (you just happen to post many answers, you may be referring to something else, which is out of context of this post)
    – Top-Master
    Jul 28 at 11:01
1

It depends on the license itself. Some OSS licenses allow you to just mention or attribute the license (Creative Commons being one of them), which would be as simple as putting a badge in your readme or just putting a "This software licensed under X license" at the bottom of the document), other licenses require the exact license terms to be located inside the repository (MIT and GPL both require this, last time I looked them up), and some more restrictive licenses have their own requirements. Reading up on your chosen license is important, and these restrictions are usually found near the beginning of the terms.

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.