Skip to content

gh repo create --team throws graphql error #639

Closed

Description

@rogeriopvl

Describe the bug

I'm creating a repository with access to an existing team:

gh repo create orgname/repo --team team-name

When pressing enter, repo is not created and cli throws graphql error:

graphql error: 'Could not resolve to a node with the global id of 'MDQ6VGVhbTM0Njg1MDU='.'

Steps to reproduce the behavior

  1. Make sure "team-name" exists as a team in the organization
  2. Type gh repo create orgname/repo --team team-name
  3. View the output

Expected vs actual behavior

Expected:

create the repo with given name and allow "team-name" to access it

Actual:

Repo is not created and cli throws:

graphql error: 'Could not resolve to a node with the global id of 'MDQ6VGVhbTM0Njg1MDU='.'

CLI version

gh version 0.6.1 (2020-03-04)
https://github.com/cli/cli/releases/tag/v0.6.1

Activity

  1. mislav commented on Mar 12, 2020

    @mislav
    Contributor

    Thank you for reporting! I can reproduce the same, and even though our GraphQL mutation to create the repository is correct, it seems like the org:read OAuth scope will be necessary for this to work. The GitHub CLI does not currently request this scope when you authenticate, and that is why you are getting this error.

    This might be a bug with the GitHub GraphQL API. There are no workarounds that I can suggest to you right now, short of:

    1. Compile gh from source after adding org:read to the list of requested OAuth scopes, then rm ~/.config/gh/config.yml to re-authenticate

      cli/auth/oauth.go

      Lines 51 to 52 in d323783

      // TODO: make scopes configurable
      q.Set("scope", "repo")
    2. Hold off until the next release of gh that fixes this.

    Creating an org repo without a --team flag seems to work.

  2. wzykubek commented on Mar 15, 2020

    @wzykubek

    Simmilar issue when I use gh repo create/ gh repo create --public.

    output:

    http error, 'https://api.github.com/graphql' failed (401): 'Bad credentials'
    

    I have this issue on my laptop but on PC it works. I reinstalled github-cli and is the same.

    OS: Arch Linux

  3. mislav commented on Mar 16, 2020

    @mislav
    Contributor

    @samedamci This looks like a different issue, but you can try re-authenticating by doing rm ~/.config/gh/config.yml and trying gh repo create again.

  4. self-assigned this
    on Mar 30, 2020
  5. mislav commented on May 7, 2020

    @mislav
    Contributor

    We now ask for an additional read:org OAuth scope, which will fix gh repo create --team in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions