When we create a new repository on GitHub , we can choose an open source license.

create_new_repo

We choose an OSS license, then, LICENSE file is put into the new repository.

Now, I’m usually using hub command to create a new repository. I’ll do below to create:

1
2
3
4
5
6
7
8
$ mkdir my_new_repository
$ cd my_new_repository
$ git init
#
# ... some code writing and commit ...
#
$ git create # git command is aliased to hub
$ git push -u origin master

In this flow, I can write description for repository1, set homepage2, make the repository private3, but I CANNOT choose LICENSE. I can choose and create LICENSE file on the GitHub web page, or I can copy from my other repositories because its content is fixed. However, I don’t do that.

Thus I created git-license , which is subcommand for git. As you know, when you put git-XXX executable into your PATH, you can use git-XXX command as subcommand of git like git XXX.

git-license is written in Go. So its executable is only one binary, and it means very easy to start using. If you have already had Go environment, you can install with:

1
$ go get github.com/nasa9084/go-license

If not, you can download binary for your os from Releases page .

The command creates LICENSE file you choose using GitHub Licenses API , so network connection is required.

If there’s some bugs, comment, or enhancement, please feel free to make issues or make Pull Request.


  1. with -d option ↩︎

  2. with -h option ↩︎

  3. with -p option ↩︎