Skip to content

Erroneous error message when using invalid license shorthand #4624

@larsvilhuber

Description

@larsvilhuber

Describe the bug

When attempting to gh repo create with a license that doesn't exist, the error message is wrong/misleading.

gh version 2.2.0 (2021-10-25)
https://github.com/cli/cli/releases/tag/v2.2.0

Steps to reproduce the behavior

gh repo create --public -l cc-by org/name-of-repo
? Would you like to add a .gitignore? Yes
? Choose a .gitignore template R
? This will create the "org/name-of-repo" repository on GitHub. Continue? Yes
HTTP 422: Repository creation failed. (https://api.github.com/orgs/org/repos)
license_template is an unknown license template.
This API operation needs the "public_repo" scope. To request it, run:  gh auth refresh -h github.com -s public_repo

Expected vs actual behavior

Expected: error message that says "cc-by is not a known license template. Please see https://fancy/place/url for allowed tags".

Actual: The error repeats. The gh app has already been granted "public_repo" scope, so that error message is misleading. Omitting the license flags (without going through the suggested auth step) yields the suggested result (repo gets created) without a license.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedContributions welcomepriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions