Which License to Use on GitHub? Understanding MIT, Apache, GPL & More


You just pushed that amazing project to GitHub! Feels great, right? You're sharing your work with the world, stars start to pop up, maybe even a fork or your first pull request. But in all that excitement, there’s one small detail many developers forget—or add without much thought: the LICENSE
file.
It might look like just another file in the repo, but the license is one of the most crucial parts of your project. It's not a formality; it's a legal document that clearly states what others can—and just as importantly, cannot—do with your code. Choosing the right license (or no license at all!) can have a big impact on how your project is used, modified, and shared.
In this guide, we’ll demystify the world of open source licenses on GitHub. We'll explain why they matter, explore popular options like MIT, Apache 2.0, and the GPL family, and help you make an informed choice for your next open source project.
💭 Why Bother With a License? The Danger of Silence
There’s a common myth: if the code is public on GitHub, anyone can use it however they want. That’s completely false.
Without an explicit license, default copyright laws apply. That means you, the author, retain all rights. No one can legally copy, modify, distribute, or even use your code without direct permission.
What happens if you skip the license?
Legal Limbo: Your code becomes unusable for many. Serious developers and companies will avoid using code without a clear license due to legal risk.
Harder Collaboration: Who owns contributions? What’s allowed? The lack of a license creates uncertainty for potential contributors.
Blocked Intentions: Even if you want to freely share your code, not having a license means others legally can’t use it safely.
The Fix: A clear open source license removes this ambiguity. It gives people specific rights to use your code—and encourages safe, legal adoption and collaboration.
⚖️ The Open Source Spectrum: Permissive vs. Copyleft
Open source licenses aren’t all the same. They exist on a spectrum—usually split into two broad categories with different philosophies:
1. Permissive Licenses
Concept: As the name implies, these are very permissive. The goal is to give users as much freedom as possible. Usually, the only real requirement is to keep the original license notice and copyright.
They allow: Use, copy, modify, distribute—even use the code in proprietary (closed source) software.
Philosophy: Maximize adoption and code reuse with minimal restrictions.
Analogy: Like giving someone a tool and saying, "Use it however you like, just keep my name on it."
2. Copyleft Licenses (or “Share-Alike”)
Concept: These also let others use, modify, and distribute the code—but with one key rule: if you distribute modified versions or derived works, you must use the same license.
They allow: Use, modification, distribution—as long as the same freedoms are preserved in any shared versions.
Philosophy: Ensure that the software and its improvements remain open and accessible to the community.
Analogy: Like sharing a tool with a note: "Use and improve it freely—but if you share it again, include this note too."
There are variations (strong vs. weak copyleft), but the core idea is this trade: you get freedom, but you must pass it on.
🚀 Popular GitHub Licenses: A Quick Tour
Let’s look at some of the most common licenses. This is a simplified overview—always read the full text before choosing a license!
Permissive Licenses
✅ MIT License
Traits: Super popular, short, simple, and easy to understand. One of the most permissive out there.
Allows: Pretty much everything—use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies.
Requires: Just that the copyright and license notice stay in the code.
Best for: Maximum simplicity and adoption, even in closed source projects.
✅ Apache License 2.0
Traits: Also permissive, but longer and more detailed than MIT. Includes patent protection, common in large/corporate projects (e.g. Android, Swift).
Allows: Same freedoms as MIT.
Requires: Keeping original notices, clearly marking changes, and includes a detailed patent grant and protection clause.
Best for: When patents matter or when you want a permissive license with more legal depth.
Copyleft Licenses (Strong)
🔒 GNU General Public License v3 (GPLv3)
Traits: The most famous and influential strong copyleft license. Designed to keep code and derivatives open.
Allows: Use, modification, distribution.
Requires: That any distributed derivative works use the same license (GPLv3) and include source code. Includes strong protections against software lockdown (“tivoization”).
Best for: Projects where it’s crucial to keep all future versions open source.
🔒 GNU Affero General Public License v3 (AGPLv3)
Traits: A variation of GPLv3 focused on network-based software (like web services).
Allows: Same as GPLv3.
Requires: Same as GPLv3, plus: if users interact with your modified software over a network, you must offer them the source code.
Best for: SaaS, APIs, and web apps—ensures server-side changes are shared too.
🧠 How to Choose the Right License?
There’s no one-size-fits-all. The best license depends on your goals for the project. Ask yourself:
Do I want my code to be used as freely as possible, even in commercial or closed source software?
→ ✅ Think MIT or Apache 2.0 (MIT for simplicity, Apache if patents matter).Is it important to me that any improvements to my code also remain open source?
→ ✅ Go with GPLv3.Is my project a web service, and I want even server-side modifications to be shared?
→ ✅ Go with AGPLv3.Am I worried about patents?
→ ✅ Apache 2.0, GPLv3, and AGPLv3 include clauses about patents. MIT doesn’t.Am I contributing to an existing project?
→ ✅ Use the same license or a compatible one! Mismatched licenses can create legal headaches.
Pro Tip: choosealicense.com is a great interactive resource maintained by GitHub that helps you decide.
📄 How to Add a License to Your GitHub Repo
Once you’ve picked a license, adding it is simple:
Create a file named
LICENSE
(orLICENSE.txt
,LICENSE.md
) at the root of your repo.Paste the full, exact text of the license you chose.
Don’t change the license wording unless you really know what you're doing. Fill in any placeholders like
[year]
or[fullname]
.Use GitHub’s helper:
When creating a repo: click “Add a license”.
In an existing repo: click “Add file” → “Create new file”, name it
LICENSE
, then click “Choose a license template” (top-right). GitHub will fill in the license for you.
✅ Bonus: Mention your license in your README.md
too—it’s good practice!
🖼️ Beyond Code: What About Docs, Images, etc.?
If your repo contains more than just code—like tutorials, docs, images, datasets—you may want to consider Creative Commons (CC) licenses for that content. They’re more appropriate for non-code materials and come in various flavors (Attribution, ShareAlike, NonCommercial, NoDerivatives, etc.). Learn more at creativecommons.org.
⚠️ Legal Disclaimer: I’m Not a Lawyer
This article provides general information and not legal advice. Licensing and IP laws can be complex. If you have specific legal concerns or enterprise needs, consult a qualified attorney.
✅ In Summary: Licensing is a Sign of Care
Choosing and applying a license to your GitHub project isn’t just bureaucracy. It’s a key step that shows professionalism and respect for your work—and for others.
A clear license:
Sets the ground rules for use.
Provides legal safety for both you and users.
Encourages collaboration and adoption.
Strengthens the open source ecosystem as a whole.
So next time you publish a project—or even when reviewing old repos—don’t forget the LICENSE file. It’s a small document that makes a big difference.
Did this guide help you better understand open source licenses?
👏 Leave a clap!
💬 Got questions or tips? Drop them in the comments!
📢 Know someone who could benefit from this info? Share it forward!
Subscribe to my newsletter
Read articles from Matheus Ricardo directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Matheus Ricardo
Matheus Ricardo
Knowledge grows when it's shared. I'm an iOS developer and eternal student building a space for devs who love to learn—welcome to Commit to Learn.