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

Error in 'git2r_clone': unsupported URL protocol #453

Open
miyesa opened this issue Jun 27, 2023 · 1 comment
Open

Error in 'git2r_clone': unsupported URL protocol #453

miyesa opened this issue Jun 27, 2023 · 1 comment

Comments

@miyesa
Copy link

miyesa commented Jun 27, 2023

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

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

@galenholt
Copy link

I get this same issue moving from R 4.2.2 to 4.3.1. With a clean project and fresh install of git2r, I can use ssh in 4.2.2 and not 4.3.1. For completeness, my results for git2r::libgit2_features() and sessionInfo() are below.

4.3.1

> git2r::libgit2_features()
$threads
[1] TRUE

$https
[1] TRUE

$ssh
[1] FALSE
> sessionInfo()
R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22621)

Matrix products: default


locale:
[1] LC_COLLATE=English_Australia.utf8  LC_CTYPE=English_Australia.utf8   
[3] LC_MONETARY=English_Australia.utf8 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.utf8    

time zone: Australia/Sydney
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.3.1 tools_4.3.1    git2r_0.32.0   renv_1.0.0 

4.2.2

> git2r::libgit2_features()
$threads
[1] TRUE

$https
[1] TRUE

$ssh
[1] TRUE
> sessionInfo()
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.utf8  LC_CTYPE=English_Australia.utf8   
[3] LC_MONETARY=English_Australia.utf8 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.utf8    

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.2.2 tools_4.2.2    git2r_0.32.0   renv_1.0.0    

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