Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install package with private Git remotes #795

Closed
jkeirstead opened this issue May 14, 2024 · 5 comments
Closed

Unable to install package with private Git remotes #795

jkeirstead opened this issue May 14, 2024 · 5 comments

Comments

@jkeirstead
Copy link

I'm developing a package using renv and it depends on other packages in private Github repositories. These are accessed via SSH and installed with renv::install('[email protected]:myorg/mypkg.git'). While this works fine for development purposes, the package will not install (e.g. devtools::install()) and fails with the following message:

Error in FUN(X[[i]], ...) : 
  can't convert package mypkg with RemoteType 'git' to remote

Here's a traceback:

d> traceback()
8: stop(sprintf("can't convert package %s with RemoteType '%s' to remote", 
       name, x$RemoteType)) at install-remote.R#230
7: FUN(X[[i]], ...)
6: lapply(deps, package2remote, repos = repos, type = type) at deps.R#76
5: structure(lapply(deps, package2remote, repos = repos, type = type), 
       class = "remotes") at deps.R#76
4: package_deps(deps, repos = repos, type = type) at deps.R#141
3: dev_package_deps(pkgdir, repos = repos, dependencies = dependencies, 
       type = type) at install.R#191
2: remotes::install_deps(pkg$path, build = build, build_opts = build_opts, 
       INSTALL_opts = opts, dependencies = dependencies, quiet = quiet, 
       force = force, upgrade = upgrade, ...)
1: install()

the relevant parts of the session info:

─ Session info ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.0.3 (2020-10-10)
 os       macOS  14.4.1
 system   x86_64, darwin17.0
 ui       RStudio
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       Europe/Berlin
 date     2024-05-14
 rstudio  2024.04.0+735 Chocolate Cosmos (desktop)
 pandoc   3.1.11 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/x86_64/ (via rmarkdown)
─ Packages ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 !  package                * version    date (UTC) lib source
 P  mypkg                 0.2.2      2022-11-09 [?] git ([email protected]:myorg/mypkg.git)
 P  devtools               * 2.4.5      2022-10-11 [?] CRAN (R 4.0.3)
 P  remotes                  2.5.0      2024-03-17 [?] CRAN (R 4.0.3)
    renv                     1.0.7      2024-04-11 [2] CRAN (R 4.0.3)

and the relevant bits of the DESCRIPTION file for the package that's being developed:

Imports: mypkg
Remotes: git::[email protected]:myorg/mypkg.git

Any idea how to resolve this?

@gaborcsardi
Copy link
Member

Can you try using r-lib/pak instead of remotes? It will require you to use a https git remote though.

@jkeirstead
Copy link
Author

If possible, I want to avoid using https git remotes as it would require changes in the rest of my build environment. Is there no fix for using SSH remotes?

@gaborcsardi
Copy link
Member

gaborcsardi commented May 14, 2024

IDK, it does not fail for me for private repos:

❯ remotes::install_git("[email protected]:gaborcsardi/playground2.git")
Downloading git repo [email protected]:gaborcsardi/playground2.git
'/opt/homebrew/bin/git' clone --depth 1 --no-hardlinks [email protected]:gaborcsardi/playground2.git /var/folders/ph/fpcmzfd16rgbbk8mxvy9m2_h0000gn/T//RtmpWQCCcU/file1018522ed21ec
Cloning into '/var/folders/ph/fpcmzfd16rgbbk8mxvy9m2_h0000gn/T//RtmpWQCCcU/file1018522ed21ec'...
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 7 (delta 0), reused 6 (delta 0), pack-reused 0
Receiving objects: 100% (7/7), done.

@jkeirstead
Copy link
Author

jkeirstead commented May 14, 2024

remotes::install_git works for me too. It seems to be something with converting the dependency to the right install_ call (see the traceback above)

@jkeirstead
Copy link
Author

An update on this: converting to https git remotes solves the problem without having to switch to pak.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants