Skip to content

GitHub dependencies can't be installed

Lorenz Walthert edited this page May 29, 2023 · 2 revisions

If you have additional_dependencies: in your .pre-commit-config.yaml that refer to a GitHub repo, such as tidyverse/dplyr, you may see the following when installing the hooks (e.g. with pre-commit install --install-hooks:

    Error: failed to resolve remote 'r-lib/pkgapi' -- failed to retrieve 'https://api.github.com/repos/r-lib/pkgapi' [error code 22]
    In addition: Warning message:
    curl: (22) The requested URL returned error: 401 
    Traceback (most recent calls last):

This is most likely due to the rate limit of GitHub. Hook repos are downloaded from GitHub, so if your .pre-commit-config.yaml file contains multiple repos, each is one clone. And then if you have R GitHub dependencies, these are more clones. Your GITHUB_PAT that you may have set in your .Rprofile is not used, since pre-commit emulates --vanilla. Please add the package to the {renv} cache interactively with renv::install("tidyverse/dplyr") after you have a GITHUB_PAT set. Or just wait a little until you can install packages again without the GITHUB_PAT.