Understanding Open Source Licensing on GitHub
Written by Saroj Adhikari on December 31, 2025
Understanding Open Source Licensing on GitHub π
When you share code on GitHub, licensing determines how others can use, modify, and distribute your work. Without a license, your project is technically not open source, and others may be hesitant to contribute or use it.
1. Why Licensing Matters π
A clear license protects both creators and users by defining usage rights and restrictions.
Without a License:
- β Your code is NOT open source
- β Others cannot legally use your code
- β No one knows what they can/cannot do
- β Limits collaboration and adoption
With a License:
- β Legal clarity for everyone
- β Defines usage rights
- β Encourages contributions
- β Protects both creators and users
2. Types of Open Source Licenses π·οΈ
Permissive Licenses (Business-friendly)
Allow almost any use with minimal restrictions.
MIT License
The most popular and permissive license.
β Allows:
- Commercial use
- Modification
- Distribution
- Private use
- Sublicensing
β οΈ Requires:
- Include original copyright notice
π‘ Best for: Projects that want maximum adoption with minimal restrictions.
Apache License 2.0
Similar to MIT but includes patent protection.
β Everything in MIT +
- Explicit patent grant
- Protection against patent lawsuits
- Requires notice of modifications
π‘ Best for: Projects involving patents or corporate contributions.
Copyleft Licenses (Protective/Reciprocal)
Require derivatives to remain open source under the same terms.
GNU GPLv3 (General Public License)
Ensures derivatives remain open source.
β Allows:
- Commercial use
- Modification
- Distribution
- Private use
β Requires:
- Share source code
- Use same license for derivatives
- State changes
π‘ Best for: Projects that want all derivatives to stay open source.
GNU LGPLv3 (Lesser GPL)
Less restrictive than GPL, allows linking with proprietary software.
β More flexible than GPL:
- Proprietary software can link dynamically
- Only modifications to library itself must be open source
π‘ Best for: Libraries that want wider adoption while protecting core code.
3. How to Add a License to GitHub π οΈ
Method 1: During Repository Creation
- Create new repository
- Click βAdd a licenseβ
- Choose from dropdown menu
- GitHub automatically creates
LICENSEfile
Method 2: Add to Existing Repository
# Navigate to your project
cd your-project
# Create LICENSE file
touch LICENSE
# Or copy a license template
curl -o LICENSE https://opensource.org/licenses/MIT
# Add and commit
git add LICENSE
git commit -m "Add MIT License"
git push