Adding a License to GitHub

I’ve rarely thought about licensing my code, but it’s something to be aware of for your work. Most of us freely share code, though I have started to add a minor copyright and as is notation to some of my presentation scripts.

Recently a user opened an issue on the SQL Cop repository, noting that without a license, there is some ambiguity for how your code might be used. There’s a short read over at on this.

I pinged a few people at Redgate to decide what might be best and got pointed to the MIT license, which you can read here:  After a brief discussion, we decided this would be fine. Actually, people gave me a couple options and said I should pick, so I did.

MIT License it is.

Adding a License

The easy way to do this is to add a file to the repo. If you have this downloaded, just create a new file and commit it. The name should be license.txt (or license). However, you can easily do this online as well.

There is a “Create a new File” in your GitHub repo. Click that.

2019-10-02 09_59_19-red-gate_SQLCop_ tSQLt tests to highlight potential problems in your database

This gives you an editor, with a name. Enter the filename.

2019-10-02 09_59_54-New File

I then pasted in the Mit license into this file. I edited the year and name for Redgate in here as well.

2019-10-02 10_01_01-SQLCop_license.txt at master · red-gate_SQLCop

I then committed, this, adding a comment. However there is another way. Once you enter the name license.txt, a button appears on the right side of the page.

2019-10-02 10_01_50-New File

This says “Choose a license template”. If you click this, you get a page with other choices.

2019-10-02 10_03_15-Add a license to way0utwest_ASimpleTalkDB

If you click the “which license” link on the right, you get taken to, where you can read a bit about the differences. If you’re not sure, read this and try to decide what works for you.

2019-10-02 10_03_31-The Legal Side of Open Source _ Open Source Guides

In our case, we’re really hosting and sponsoring the project, so the MIT license makes sense. If I go back to the previous page and pick that, I see the license overview and the edits on the right.  I changed this from my name to the company, but this defaults to you.

2019-10-02 10_05_15-HTA_10_FinalThoughts.pptx - PowerPoint

If I click this, I go back to the file page, with the edits filled in. Note the name changes to LICENSE.

2019-10-02 10_06_41-New File

I still need to add a commit message and commit this (or create a PR), but this is the meat of the process.

Add a license to your repo to be clear, but make sure it’s the right one for you.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , . Bookmark the permalink.