Skip to content

gh repo create asks if I want to create an Internal repository for an owner that doesn't support such things #9464

@jsoref

Description

@jsoref

Describe the bug

gh --version
gh version 2.54.0 (2024-07-31)
https://github.com/cli/cli/releases/tag/v2.54.0

Steps to reproduce the behavior

% gh repo create
? What would you like to do? Create a new repository on GitHub from scratch
? Repository name test-internal
? Repository owner jsoref
? Description test creating an internal repository when gh knows this is not allowed
? Visibility  [Use arrows to move, type to filter]
  Public
  Private
> Internal
? Visibility Internal
? Would you like to add a README file? No
? Would you like to add a .gitignore? No
? Would you like to add a license? No
? This will create "test-internal" as a internal repository on GitHub. Continue? Yes
GraphQL: Only organization-owned repositories can have internal visibility (createRepository)

Expected vs actual behavior

Don't show Internal as an option if the owner doesn't support it

Logs

> POST /graphql HTTP/1.1
> Host: api.github.com
> Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
> Authorization: token ████████████████████
> Content-Length: 85
> Content-Type: application/json
> Graphql-Features: merge_queue
> Time-Zone: America/Toronto
> User-Agent: GitHub CLI 2.54.0

{
  "query": "query UserCurrent{viewer{login,organizations(first: 100){nodes{login}}}}"
}

< HTTP/2.0 200 OK
...
{
  "data": {
    "viewer": {
      "login": "jsoref",
      "organizations": {
        [
...
        ]
      }
    }
  }
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreThis issue is not accepting PRs from outside contributorsgh-reporelating to the gh repo commandp1Affects a large population and inhibits work

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions