r-lib / remotes

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

Unable to install more than one private repository at a time with devtools::install_git #770

Closed g-pires closed 9 months ago

g-pires commented 9 months ago

Hi,

I've been trying to install two private repositories from gitlab using

devtools::install_git("address-to-private-repo/package.git", credentials = git2r::cred_user_pass("username", getPass::getPass()), ref = "DEV")

I works well with the first package, however when I try ton install a second package (which directly depends on the first one) it fails with this error : Error: Failed to install 'unknown package' from Git: Error in 'git2r_remote_ls'

After removing the first package I was able to install the second one, but the problem is that the second one directly depends on the first one so it wouldn't install either.

Do you have any idea of why it could throw this error ?

Thanks in advance,

Kind regards.

R FoReveR

jennybc commented 9 months ago

devtools::install_git() is actually just remotes::install_git(), so I'm going to transfer this issue to that repo.

gaborcsardi commented 9 months ago

@g-pires We are focusing on the development of pak now, please try this with pak (see https://pak.r-lib.org/reference/install.html for installation).

This works fine for two of my private repos:

❯ pak::pkg_install("git::https://github.com/gaborcsardi/private")

β†’ Will install 1 package.
β†’ Will download 1 package with unknown size.
+ private   0.0.0.9000 πŸ‘·πŸΎπŸ”§ ⬇
β„Ή Getting 1 pkg with unknown size
βœ” Got private 0.0.0.9000 (source) (96 B)
βœ” Downloaded 1 package (96 B) in 471ms
β„Ή Packaging private 0.0.0.9000
βœ” Packaged private 0.0.0.9000 (964ms)
β„Ή Building private 0.0.0.9000
βœ” Built private 0.0.0.9000 (546ms)
βœ” Installed private 0.0.0.9000 (git::https://github.com/gaborcsardi/private@eb2fead) (16ms)
βœ” 1 pkg: added 1, dld 1 (NA B) [4.5s]
❯ pak::pkg_install("git::https://github.com/gaborcsardi/installlite")

β†’ Will install 1 package.
β†’ Will download 1 package with unknown size.
+ installlite   0.0.0.9000 πŸ‘·πŸΌβ€β™‚οΈπŸ”§ ⬇
β„Ή Getting 1 pkg with unknown size
βœ” Got installlite 0.0.0.9000 (source) (96 B)
βœ” Downloaded 1 package (96 B) in 567ms
β„Ή Packaging installlite 0.0.0.9000
βœ” Packaged installlite 0.0.0.9000 (267ms)
β„Ή Building installlite 0.0.0.9000
βœ” Built installlite 0.0.0.9000 (788ms)
βœ” Installed installlite 0.0.0.9000 (git::https://github.com/gaborcsardi/installlite@452b3f1) (18ms)
βœ” 1 pkg: added 1, dld 1 (NA B) [3.6s]
g-pires commented 9 months ago

Hello,

Thank you for your quick answers. I finally managed to install both packages.

For those who are still looking for the answer, when you want to install two packages (A and B) from two private repositories hosted on a private instance of gitlab (or github) and B is directly dependant of A, you will have to set an environment variable GITLAB_PAT (or GITHUB_PAT). That way you will be able to install both packages with the following command: devtools::install_gitlab("username/package@ref", host= "adress-to-private-repo")

Thank you again.

Kind regards,

R FoReveR