Skip to content

gh repo sync demands upstream SAML enforcement #11001

Description

@damieng

Describe the bug

I have a personal fork of a repo with no SAML requirements. The upstream public repo has SAML requirements.

Using the GitHub web interface I can hit the "sync fork" button on my personal fork and it will work even though this machine has no ability to meet the SAML requirements. This makes sense, it requires no non-public permissions to the upstream to achieve a sync.

However running gh repo sync my-repo-name on this machine brings up:

GraphQL: Resource protected by organization SAML enforcement. You must grant your OAuth token access to this organization. (repository.parent)

Which then requires a authorization in my browser (which I can not do as this machine does not and can not have the required software installed on it)

Affected version

2.70.0

Steps to reproduce the behavior

  1. Fork a public repo that requires SAML permissions to operate on
  2. Attempt to run gh repo sync <myfork>
  3. Observe error/superfluous auth request
  4. (Optional) observe that the web UI does not have this problem

Expected vs actual behavior

I expect the sync operation to complete without the GraphQL SAML enforcement.

Logs

Paste the activity from your command line. Redact if needed.

* Request to https://api.github.com/graphql
> POST /graphql HTTP/1.1
> Host: api.github.com
> Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
> Authorization: token <redacted>
> Content-Length: 530
> Content-Type: application/json; charset=utf-8
> Graphql-Features: merge_queue
> Time-Zone: Europe/London
> User-Agent: GitHub CLI 2.70.0

GraphQL query:
fragment repo on Repository {
    id
    name
    owner { login }
    hasIssuesEnabled
    description
    hasWikiEnabled
    viewerPermission
    defaultBranchRef {
      name
    }
  }

  query RepositoryInfo($owner: String!, $name: String!) {
    repository(owner: $owner, name: $name) {
      ...repo
      parent {
        ...repo
      }
      mergeCommitAllowed
      rebaseMergeAllowed
      squashMergeAllowed
    }
  }
GraphQL variables: {"name":"<redacted>","owner":"damieng"}

⢿< HTTP/2.0 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
< Content-Security-Policy: default-src 'none'
< Content-Type: application/json; charset=utf-8
< Date: Mon, 19 May 2025 16:11:59 GMT
< Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
< Server: github.com
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< Vary: Accept-Encoding, Accept, X-Requested-With
< X-Accepted-Oauth-Scopes: repo
< X-Content-Type-Options: nosniff
< X-Frame-Options: deny
< X-Github-Media-Type: github.v4; param=merge-info-preview.nebula-preview; format=json
<redacted headers>

{
  "data": {
    "repository": {
      "id": "<redacted>",
      "name": "<redacted>",
      "owner": {
        "login": "damieng"
      },
      "hasIssuesEnabled": false,
      "description": "<redacted>",
      "hasWikiEnabled": false,
      "viewerPermission": "ADMIN",
      "defaultBranchRef": {
        "name": "main"
      },
      "parent": null,
      "mergeCommitAllowed": true,
      "rebaseMergeAllowed": true,
      "squashMergeAllowed": true
    }
  },
  "errors": [
    {
      "type": "FORBIDDEN",
      "path": [
        "repository",
        "parent"
      ],
      "extensions": {
        "saml_failure": true
      },
      "locations": [
        {
          "line": 18,
          "column": 4
        }
      ],
      "message": "Resource protected by organization SAML enforcement. You must grant your OAuth token access to this organization."
    }
  ]
}

* Request took 443.4428ms
GraphQL: Resource protected by organization SAML enforcement. You must grant your OAuth token access to this organization. (repository.parent)
Authorize in your web browser:  https://github.com/enterprises/<redacted>/sso?authorization_request=<redacted>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmore-info-neededMore info needed from user/contributorneeds-triageneeds to be reviewed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions