Description
I am trying to clone a private repo in R using Rstudio with git2r and I am getting the following error:
>git2r::clone(url = repo, local_path = dir_name, progress = T, branch = branch, credentials = creds)
cloning into 'C:\Users\...'...
Error in git2r::clone(url = repo, local_path = dir_name, progress = T, :
Error in 'git2r_clone': unsupported URL protocol
The credentials variable used in the function git2r::clone()
is the following,
creds <- try(git2r::cred_ssh_key(git2r::ssh_path("id_rsa.pub"), git2r::ssh_path("id_rsa")), silent = T)
I need to clone the repo and install different packages from the repo. I am trying to do so by using SSH keys.
I was able to do this before, I changed from R-4.1.3 to R-4.3.1 and installed the same R packages with corresponding version with renv package, I also tried installing the latest versions of packages.
The only difference I can see now is when running git2r::libgit2_features() I get the following,
In R-4.3.1 I get the following:
git2r::libgit2_features()
$threads
[1] TRUE
$https
[1] TRUE
$ssh
[1] FALSE
In R-4.1.3 I get the following:
git2r::libgit2_features()
$threads
[1] FALSE
$https
[1] TRUE
$ssh
[1] TRUE
Is there a way to change ssh to True. I am using Windows 10, found some examples of how to do this in Linux but not in windows.
If I switch back to the old version of R (R-4.1.3) I can clone the private repo without any issues.
Session info after successfully cloning private repo (R-4.1.3) and when getting error (R-4.3.1):
R-4.1.3 and R-4.3.1 (with same packages version)
R-4.1.3
> sessioninfo::session_info()
- Session info -----------------------------------------------------------------------------------------------------------------------------------------------
setting value
version R version 4.1.3 (2022-03-10)
os Windows 10 x64 (build 19045)
system x86_64, mingw32
ui RStudio
date 2023-06-23
rstudio 2023.06.0+421 Mountain Hydrangea (desktop)
pandoc NA
- Packages ---------------------------------------------------------------------------------------------------------------------------------------------------
package * version date (UTC) lib source
cli 3.3.0 2022-04-25 [1] CRAN (R 4.1.3)
git2r 0.30.1 2022-03-16 [1] CRAN (R 4.1.3)
renv 0.16.0 2022-09-29 [1] CRAN (R 4.1.3)
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.1.3)
[1] C:/.../R/R-413/library
--------------------------------------------------------------------------------------------------------------------------------------------------------------
R-4.3.1
> sessioninfo::session_info()
─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 4.3.1 (2023-06-16)
os Windows 10 x64 (build 19045)
system x86_64, mingw32
ui RStudio
date 2023-06-23
rstudio 2023.06.0+421 Mountain Hydrangea (desktop)
pandoc NA
─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
cli 3.3.0 2022-04-25 [1] CRAN (R 4.3.0)
git2r 0.30.1 2022-03-16 [1] CRAN (R 4.3.0)
httr 1.4.2 2020-07-20 [1] CRAN (R 4.3.0)
R6 2.5.1 2021-08-19 [1] CRAN (R 4.3.1)
renv 0.17.3 2023-04-06 [1] CRAN (R 4.3.1)
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.1)
[1] C:/.../R/R-4.3.1/library
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Also Session Info with R-4.3.1 with latest version of packages:
R-4.3.1 (with latest packages)
> sessioninfo::session_info()
─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 4.3.1 (2023-06-16 ucrt)
os Windows 10 x64 (build 19045)
system x86_64, mingw32
ui RStudio
date 2023-06-27
rstudio 2023.06.0+421 Mountain Hydrangea (desktop)
pandoc NA
─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
cli 3.6.1 2023-03-23 [1] CRAN (R 4.3.1)
git2r 0.32.0 2023-04-12 [1] CRAN (R 4.3.1)
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.1)
[1] C:/.../R-4.3.1/library
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────