Skip to content

Some HTTP 403 errors offer context #1929

Closed

Description

@aronatkins

Using usethis 2.2.2, I struggled to understand why a refreshed GitHub token was not usable. Even after the token-update dance, I was still seeing errors like the following from usethis::use_release_issue():

Error: Unable to get GitHub info for these remotes: 'origin'
Are we offline? Is GitHub down? Has the repo been deleted?
Otherwise, you probably need to configure a personal access token (PAT) for 'github.com'
See `?gh_token_help` for advice

The feedback from usethis::git_sitrep() was similar:

• Desc = 'origin' is a GitHub repo and 'upstream' is either not configured or is not a GitHub repo.
  
  We may be offline or you may need to configure a GitHub personal access
  token. `gh_token_help()` can help with that.
  
  Read more about what this GitHub remote configurations means at:
  'https://happygitwithr.com/common-remote-setups.html'

I did not uncover any actionable feedback until digging into the lower-level calls made by usethis. Directly calling gh::gh() gave me:

Error in `gh::gh()`:
! GitHub API error (403): Resource protected by organization SAML enforcement. You must
  grant your Personal Access token access to this organization.
ℹ Read more at
  <https://docs.github.com/articles/authenticating-to-a-github-organization-with-saml-single-sign-on/>
Run `rlang::last_trace()` to see where the error occurred.

This was enough of a reminder - our SSO needs tokens to be authorized (a separate step after creation / refresh).

Is it possible for context about the original error to be provided to some of the higher-level calls?

Activity

  1. added
    feature
    git
    on Dec 14, 2023
  2. added this to the Backlog milestone on Jul 24, 2025
  3. added a commit that references this issue on May 12, 2026
    8501ac1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featuregit

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions