Guides · 08

A Practical Guide to Applying a License

The actual steps for applying a license to a repository: the LICENSE file, copyright year and holder, Apache NOTICE, the GNU COPYING convention, file headers, third-party notices, DCO and CLA, and what to watch when changing licenses.

Last checked: 2026-09-23

1. A LICENSE file at the repository root

The first thing to do is put the license text in a LICENSE (or LICENSE.txt, LICENSE.md) file at the root of the repository. GitHub, GitLab and package managers look for this file to detect the license. Choose a license in the generator, enter the year and copyright holder, and you can download it right away.

2. Year and copyright holder

3. Companion files by license

LicenseConvention
Apache-2.0LICENSE + NOTICE if needed (short attribution notices only)
GPL-3.0 / GPL-2.0Text in COPYING or LICENSE
LGPL-3.0COPYING (GPL-3.0 text) + COPYING.LESSER (LGPL-3.0 text)
MIT OR Apache-2.0LICENSE-MIT + LICENSE-APACHE
BSL-1.0LICENSE_1_0.txt

The Apache-2.0 NOTICE is not mandatory, but anyone redistributing code that has a NOTICE must keep its contents. The ASF recommends putting only legally required attribution notices in NOTICE, not thank-yous or full license texts.

4. Source file headers

A short header in each file means the license information travels with the file even if it is copied on its own.

# SPDX-FileCopyrightText: 2026 Example Inc.
# SPDX-License-Identifier: Apache-2.0

GNU, Apache and MPL also recommend their official notices, but more and more projects replace them with just the two SPDX lines. See the SPDX guide for details.

5. Package metadata and README

6. Third-party code notices

If you distribute other people's code with yours, you must also meet their license obligations.

7. Accepting contributions: DCO or CLA

Accepting outside contributions splits copyright among many people. There are two ways to manage this.

Write the contribution rules in CONTRIBUTING.md.

8. Changing the license

Checklist

  1. LICENSE text (only placeholders filled in)
  2. Companion files (NOTICE, COPYING.LESSER, etc.)
  3. File headers (two SPDX lines)
  4. Package metadata and README
  5. Third-party notices
  6. Contribution rules (DCO or CLA)
This article is general information, not legal advice. Consult a professional for important decisions.

Sources