Skip to content

Unable to install public R packages on GitHub if SAML turned on (GitHub Enterprise) #818

@eeholmes

Description

@eeholmes

Background

We have R packages on public repositories on GitHub Enterprise. SAML is turned on. But the repos are fully public and there are no restrictions to downloading, cloning or forking. But if we try to install the packages with install_github(), we get a error if the user has a PAT. Deleting the PAT will cause installation to work. The error is only with packages on GitHub Enterprise with SAML turned on.

Reprex

  1. Make sure a PAT is created.
usethis::create_github_token() 
credentials::set_github_pat("YourPAT")
  1. Try to install package
    This produces the error:
remotes::install_github("nmfs-ost/satf")
Using GitHub PAT from the git credential store.
Error: Failed to install 'unknown package' from GitHub:
  HTTP error 403.
  Resource protected by organization SAML enforcement. You must grant your Personal Access token access to this organization.

  Rate limit remaining: 4986/5000
  Rate limit reset at: 2024-11-14 17:49:00 UTC
  1. Delete the PAT
gitcreds::gitcreds_delete()

Now remotes::install_github("nmfs-ost/satf") works

  1. Test on a fork that is not in Enterprise w SAML
remotes::install_github("eeholmes/satf")

works when there is a PAT.

Where the problem appears

curl::curl_fetch_memory(url, handle = h)

called in

remotes:::github_DESCRIPTION()

The values are

url= "https://api.github.com/repos/nmfs-ost/satf/contents/DESCRIPTION?ref=HEAD"

headers

Accept 
"application/vnd.github.v3.raw" 
Authorization 
"token xxxx"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions