License Your Code Right: A GitHub Must-Do

License Your Code Right: A GitHub Must-Do

·

6 min read

Introduction

When you create a repo on GitHub, you will see the license option for your project. Although license selection is not mandatory, it can be important to determine how others can use your source code.

Has anyone ever wondered what this license means?

A license is a legal document that defines the rights of users to the source code of a project. There are many different types of licenses, each with different rights and restrictions.

GitHub Licenses

Each type of license has its own terms and conditions, but they are generally divided into two main categories.

  • Copyleft licenses require that all copies of the source code be distributed under the same license. This means that software licensed under GPL is always open source and free.

  • Permissive licenses allow users to use and distribute the source code in any way they want, as long as they give credit to the author.

When choosing a license, you need to consider the following factors:

  • How do you want others to be able to use your source code? Can they use it in commercial projects? Can they modify and redistribute your source code?

  • How do you want to protect your copyright (intellectual property)? Some licenses can help you protect your copyright better than others.

Apache License 2.0

Type: Permissive

Allows: Others to use, copy, modify, distribute, and sell your source code without your permission. However, this license requires you to give credit to the author of the source code.

Commonly used by: Apache software projects, Android, OpenSSL, etc.

GNU General Public License v3.0

Type: Copyleft

Allows: Others to use, copy, modify, distribute, and sell your source code. However, this license requires that any software built on top of your source code also be licensed under GPLv3.

Commonly used by: Linux, GNU utilities, LibreOffice, etc.

MIT License

Type: Permissive

Allows: Others to use, copy, modify, distribute, and sell your source code without your permission. The main condition is to keep the copyright notice and not make any warranty.

Commonly used by: jQuery, Ruby on Rails, Node.js, etc.

BSD 2-Clause "Simplified" License

Type: Permissive Allows: Others to use, copy, modify, distribute, and sell your source code without your permission. This license requires you to give credit to the author of the source code, but does not require you to distribute your source code under the same license. Commonly used by: BSD operating system, OpenBSD, SQLite, etc.

BSD 3-Clause "New" or "Revised" License

Type: Permissive

Allows: Others to use, copy, modify, distribute, and sell your source code without your permission. Expanding from BSD 2-Clause, this license requires you to give credit to the author of the source code and distribute your source code under the same license, as well as requiring you not to use the names of the authors or organizations to promote the product.

Commonly used by: BSD operating system, Lua, Nginx, etc.

Boost Software License 1.0

Type: Permissive

Allows: Others to use, copy, modify, distribute, and sell your source code without your permission. This license requires you to give credit to the author of the source code, but does not require you to distribute your source code under the same license. Similar to MIT, but has an additional condition to avoid using the name, logo, or trademark of the authors or development organizations to promote the product.

Commonly used by: Boost libraries, many C++ projects

Creative Commons Zero v1.0 Universal

Type: Public

Allows: Others to use, copy, modify, distribute, and sell your source code without your permission. Why is the type of this license not under the two definitions above? It belongs to the public domain type, which means that all copyright and related rights are waived, maximizing the ability to reuse without restrictions.

Commonly used by: Creative works, open data, scientific publications

Eclipse Public License 2.0

Type: Copyleft

Allows: Others to use, copy, modify, distribute, and sell your source code without your permission. This license requires you to give credit to the author of the source code, but does not require you to distribute your source code under the same license. Commonly used by: Eclipse IDE, projects in the Eclipse Foundation.

GNU Affero General Public License v3.0

Type: Copyleft

Allows: Others to use, copy, modify, distribute, and sell your source code without your permission, but they must also distribute their source code under the same license.

Meaning: Software licensed under AGPL is always free and open source software, even if it is distributed as a SaaS application.

GNU General Public License v2.0

Type: Copyleft

Allows: Others to use, copy, modify, distribute, and sell your source code without your permission, but they must also distribute their source code under the same license.

Meaning: Software licensed under GPL is always free and open source software.

GNU Lesser General Public License v2.1

Type: Copyleft

Allows: Others to use, copy, modify, distribute, and sell your source code without your permission, but only in free software applications. Meaning: The modified code can be modified and distributed, even in proprietary software, as long as the modified code is clearly separated from the proprietary components.

Mozilla Public License 2.0

Type: Permissive

Allows: Users to use, modify, and distribute the code, for both commercial and non-commercial purposes. Meaning: This license is compatible with other open source licenses, including GPL and Apache.

Commonly used by: This license is commonly used for web-based and browser-related software.

The Unlicense

Allows: Code licensed under The Unlicense can be used in any software project, for any purpose. The code can also be modified and distributed without the author's permission.

Meaning: This license allows for unlimited use, modification, and distribution of the code, even for commercial purposes.

Add license to your project

After you have selected license, you can add license to your repo using the LICENSE.md file. This file should contain the name of the license, the version of a license and a link to the full text of the licence.

For example: If you choose to use MIT License, you can add the following LICENSE.md file to your repo:

# MIT License
Copyright (c) bunhere.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

End

By choosing the right license for your repo, you can help ensure that your source code is used the way you want.

Research more here: licensing-a-repository

Find me: bunhere.com

I am always looking for feedback on my writing, so please let me know what you think. ❤️