r-lib / remotes

Install R packages from GitHub, GitLab, Bitbucket, git, svn repositories, URLs
https://remotes.r-lib.org/
Other
331 stars 152 forks source link

Propagate 'auth_token' to dependencies in 'install_github()' #644

Closed abichat closed 2 years ago

abichat commented 3 years ago

In our company pipeline, we have several private GitHub-hosted packages, with interdependencies. But I can't simply install one with private dependency as I do usually... For instance, when I try to install pkg1, which depends on pkg2, I got this error message:

> remotes::install_github("company/pkg1", auth_token = "mytoken")
Downloading GitHub repo company/pkg1@HEAD
Error: Failed to install 'pkg1' from GitHub:
  HTTP error 404.
  Not Found

  Did you spell the repo owner (`company`) and repo name (`pkg2`) correctly?
  - If spelling is correct, check that you have the required permissions to access the repo.

However, I have no problem to first install pkg2 and then install pkg1 if I ignore dependencies:

install_github("company/pkg2", auth_token = "mytoken")
install_github("company/pkg1", auth_token = "mytoken", dependencies = FALSE)

But this could be a little bit cumbersome with lots of private dependencies (typically a verse package) or not already installed public ones.

Is it possible/planned to propagate the auth_token argument to automatically install private dependencies? Thanks!

NB: I already saw this problem in the comment of a closely related issue: https://github.com/r-lib/remotes/issues/554#issuecomment-749827607.

> packageVersion("remotes")
[1] ‘2.4.0’
jimhester commented 2 years ago

My advice in that issue would be the same, I would suggest you set the envvar for these cases.