3

When I add a license to a software project I place the text of the license in a file named LICENSE.md in the root of the repository.

Now I want to include the license text in the README.md instead and not add a LICENSE.md file to my projects.

Should I refrain from doing that or can I get away with it? No special reason, I just want to. If it matters, my preferred license is MIT.

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

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.

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.