DEV Community

nasa9084
nasa9084

Posted on • Originally published at blog.web-apps.tech on

Generates LICENSE file: git-license

this post originally appears on blog.web-apps.tech

Generates LICENSE file: git-license

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

Generates LICENSE file: git-license

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:

$ 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 repository[1], set homepage[2], make the repository private[3], 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:

$ 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 ↩︎

Top comments (0)