I would like to use some code from an MIT-licensed project I don't own (let's call it project A), in a project (B) with a different license. It is my understanding that I can do whatever I want with this MIT-licensed code, as long as the license and attribution stay with the code.

In this case, the license is in a file at the root of project A's repository. Is it OK to copy a file from project A to project B, and add the license's content in a header in this file, instead of keeping it as a separate file? Do I have to keep the license file somewhere instead, and if I do, how should I specify which files in the project are under this license? Is a link to the original repository/license added at the top of the copied file enough?

  • What licence do you intend to release project B under?
    – MadHatter
    Commented Jun 4, 2020 at 6:27
  • @MadHatter it’s an internal, proprietary project that won’t be used outside of my org anytime soon, we haven’t even bothered choosing a license. But I want the codebase to be clean IP-wise.
    – Hey
    Commented Jun 4, 2020 at 8:19

1 Answer 1


Adding the (unmodified) license including the authorship & copyright notice to the header of each file you copy, should be fine - and makes clear(er) which files fall under that license. Thus this version is IMHO preferrable over a solution where you keep the original license file and another for the files of your project and the need to indicate which files are under which license.

If applicable and possible you could put the copied files in their own sub-directory along with the license file. That way it is also very clear that all files in that directory fall under the license found adjacent to it.

Just linking to the original source does not suffice as it fails the desert island test as it requires an online connection to obtain the information about the rights you have on those files.

(However, I'm not a lawyer)

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.