GitHub provides an option to include a software license in your project when you create a new repository.

Public repositories on GitHub are often used to share open source software. Open source software is software that is licensed so that others are free to use, change, and distribute the software.

Screenshot of license picker on GitHub.com

Which license is right for me?!

Don't fret! Choosing an open source license can be confusing. That's why we created choosealicense.com, a website that helps you make decisions about how to license your code. A software license tells others what they can and can't do with your source code. There's a handful of standard and well-known software licenses out there to choose from.

What happens if I don't choose a license?

You're under no obligation to choose a license. It's your right not to include one with your code or project, but please be aware of the implications. Generally speaking, the absence of a license means that the default copyright laws apply. This means that you retain all rights to your source code and that nobody else may reproduce, distribute, or create derivative works from your work. This might not be what you intend.

Even if this is what you intend, if you publish your source code in a public repository on GitHub, you have accepted the Terms of Service which do allow other GitHub users some rights. Specifically, you allow others to view and fork your repository.

If you want to share your work with others, we strongly encourage you to include an open source license.

Where does the license live on my repository?

Most people place their license text in a file named LICENSE.txt (or LICENSE.md) in the root of the repository; here's an example from Hubot.

As long as your intention is clear, you can place your license information wherever you like. Some projects only include a descriptive line in the project's README (e.g., "This project is licensed under the terms of the MIT license."). However, to avoid any potential ambiguity, it's best to include the license file with your project as well.

I already have a project with a license file, do I need to do anything?

Nope. You're golden. Happy open sourcing.

Can I search GitHub by license type?

There's no search filter to limit search results to projects licensed under certain terms, but because the text of the license is committed to the project's git repository, there's no reason you can't use GitHub's code search to find projects with a certain license file. For example, here's a search for projects licensed under the GNU General Public License.

What about my existing repositories?! Does this make them open source?

The license picker only affects new projects, and it's completely optional. We're just making it easier for people to make their intentions clear about how others can user their source code through a license. If you already have a project on GitHub, and it doesn't have a license file or other text indicating what rights you are granting to others, you retain all rights to the software, except those outlined in the GitHub Terms of Service.

How can I go back through my public repositories and give them licenses?

The license picker is only available when you create a new project on GitHub. Because the license is simply a text file committed to the Git repository, you may be able to automate the process using the GitHub API. You can manually add a license using the browser. For example, when you are on a repository home page, you can click on the + icon. To make the process easier, if you name the newly created file LICENSE.md, the license picker automatically appears.

Alternatively, you can simply navigate to the "new/master" URL. For example, for Hubot, this would be https://github.com/github/hubot/new/master. Note that you need permission to edit the repository for that URL to work. Enter the name LICENSE and paste the license text into the editor.

If you're looking to add licenses to a large number of repositories, the website addalicense.com may be able to help automate this process. However, please note that the site is not owned by or affiliated with GitHub, so we can't guarantee it'll work in all cases.

Disclaimer

We're not lawyers. Well, most of us anyway. It is not the goal of this page to provide legal advice. The goal of this page is to provide a starting point to help you make an informed choice. If you have any questions regarding the right license for your code or any other legal issues relating to it, it’s always best to consult with a professional.