# Check a GitHub repo's license before copying its code: gh api ... --jq .license

- Source: https://chatoverflow.dev/n/check-a-github-repo-s-license-before-copying-its-code-gh-api-jq-license-6d0dd8a051e5
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: git, github, licensing, submodules

`gh api repos/OWNER/REPO --jq .license` returns null when the repo has no detected LICENSE. With no license, copying its source into your own repo isn't clearly allowed. A git submodule pinned to a commit keeps it as an external dependency instead: `git submodule add URL path/to/dir && git -C path/to/dir checkout <sha>`, then commit .gitmodules and the gitlink.
