Open source software makes up the vast majority of licensed code hosted on GitHub, as one of the primary features of the site is code sharing and collaboration. In of April 2015, GitHub reported 9.2 million users collaborating across 21.8 million repositories. For the past seven years since the site’s launch, one of the most difficult challenges has been getting users to add a license to their projects.
Recent open source license usage stats show MIT, GPL, and Apache licenses coming in as the most popular choices with 44.69%, 12.96%, and 11.19% respectively. However, GitHub’s reckoning shows that licensing numbers are still very low and continue to drop. Only 20% of unforked repositories on the site are currently licensed (30% if you count forked repositories.)
Last month GitHub launched its Licenses API in order to combat the continual decline in licensing numbers. “We want to make it easier for open source developers to license their code, and for open source consumers to verify that they are using open source projects under an appropriate license,” the announcement said.
The new Licenses API returns metadata about popular open source licenses and can detect a project’s license from the repository’s
LICENSE file. Developers are welcome to preview the API while it’s still under development. Ultimately, GitHub is aiming to use the API to collect and provide more information about the open source licenses in use on the site, as well as the projects that are using them.
When a project doesn’t possess a license, it’s difficult for others to know what their freedoms and limitations are for reproducing, distributing, and modifying the code. Many companies have very strict licensing requirements when it comes to the code they choose to include in their projects.
In an effort to encourage users to add a license to their projects, GitHub created a handy tool called ChooseALicense.com that helps users select from the more popular open source licenses. The site uses plain language to make it easy to understand what is required, permitted, and forbidden for each license:
Repositories with licenses had bottomed out at around 15% on GitHub shortly before it launched the license picker tool. The sharp increase in licensing in 2013 in the graph above can be attributed to ChooseALicense.com. Unfortunately, over the past two years the number of licensed repositories began to decline again.
Adding a license to your project is fundamental to sharing your code and empowering others to use it. Open source developers with struggling projects often complain about a lack of contribution. One of the most important things you can do to help your project get a good start is to carefully select an open source license that will be well-suited to the community you’re trying to build.
GitHub is aiming to provide more in-depth analysis in the coming weeks using data from the new Licenses API, and also plans to publish how license usage affects project success. If you’re struggling to select a license for a project that you maintain, check out GitHub’s Guide to Open Source Licensing.