Guides · 03

What Code Without a License Means

Public code without a license file has all rights reserved by its copyright holder by default. Learn what GitHub's terms allow, what to do if you want to use such code, and how to add a license to your own repository.

Last checked: 2026-09-23

Public ≠ permission

Even a repository published on GitHub is not open source if it has no LICENSE file. Copyright arises automatically the moment code is written (in most Berne Convention countries), and without separate permission only the copyright holder may copy, modify, distribute or create derivative works. GitHub's documentation also explains that without a license, default copyright law applies, the copyright holder retains all rights, and nobody else may reproduce, distribute or create derivative works.

What GitHub's terms allow

Under GitHub's Terms of Service (D.5, "License Grant to Other Users"), anyone who posts content in a public repository grants GitHub users the right to use, display and perform that content through the GitHub service, and to reproduce it only as permitted by GitHub's functionality, such as forking. So the following is allowed:

However, the terms do not grant rights beyond this, such as including it in your product and distributing it, or publishing a modified version elsewhere.

If you want to use unlicensed code

  1. Ask the copyright holder: Request a license via an issue or email. In many cases they simply forgot and will gladly add MIT or similar.
  2. Get written permission: If adding a license is difficult, obtain and keep a separate permission stating the scope of use.
  3. Find an alternative: Look for an open source library with the same functionality.
  4. Implement it yourself: Write new code based only on the specification or behavior without looking at the code (a so-called clean-room implementation). Be careful: transcribing the original code may count as copying.
A README that only says "use it however you like" is ambiguous. The intent may seem clear, but the scope (modification, redistribution, commercial use) is unclear, so it is safer to ask for a standard license to be added.

Common ambiguous cases

How to add a license to your repository

  1. Choose a license in the generator, enter the year and copyright holder, and download the LICENSE file.
  2. Commit it to the root of the repository. GitHub detects this file and shows the license in the repository information.
  3. Put the SPDX identifier in the license field of package.json, Cargo.toml, pyproject.toml and similar files (SPDX guide).
  4. If other people's code is mixed in, sort out the licenses and notices for those parts separately (applying a license).

Deliberately not adding a license

If you only want to show your code, such as a portfolio or coursework, and do not want it reused, not adding a license is also a choice. In that case, writing "All rights reserved" and your contact details in the README reduces misunderstandings. However, as long as the repository is public, you cannot prevent the viewing and forking that GitHub's terms allow.

This article is general information, not legal advice. Consult a professional for important decisions.

Sources