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

Problem installing with depolyment keys from gitlab using `git2r` #670

Open bart1 opened 2 years ago

bart1 commented 2 years ago

I just encountered an issue where installing package from a private repository using deployment tokens on gitlab fails when using install_git with the default git2r but works with external git. I was first caught by the bug with the @ in the url but using the development verion of remote this seems to be resolved. Note that in the example below the message about terra is unrelated.

url<-"http://tokenuser:aWGB9kyGjAfxPv5H7QF8@gitlab.com/test_group901/starsTileServer.git"
remotes::install_git(url, force=T)
#> Error: Failed to install 'unknown package' from Git:
#>   Error in 'git2r_remote_ls'
remotes::install_git(url, force=T, git = 'external')
#> Downloading git repo http://tokenuser:aWGB9kyGjAfxPv5H7QF8@gitlab.com/test_group901/starsTileServer.git
#> '/usr/bin/git' clone --depth 1 --no-hardlinks http://tokenuser:aWGB9kyGjAfxPv5H7QF8@gitlab.com/test_group901/starsTileServer.git /tmp/RtmpEtgqzF/file3294bd5ef8909
#> terra (NA -> 1.4-22) [CRAN]
#> Installing 1 packages: terra
#> Installing package into '/home/bart/R/x86_64-pc-linux-gnu-library'
#> (as 'lib' is unspecified)
#> Warning in i.p(...): installation of package 'terra' had non-zero exit status
#>      checking for file ‘/tmp/RtmpEtgqzF/file3294bd5ef8909/DESCRIPTION’ ...  ✓  checking for file ‘/tmp/RtmpEtgqzF/file3294bd5ef8909/DESCRIPTION’
#>   ─  preparing ‘starsTileServer’:
#>        checking DESCRIPTION meta-information ...  ✓  checking DESCRIPTION meta-information
#>   ─  checking for LF line-endings in source and make files and shell scripts
#>   ─  checking for empty or unneeded directories
#>    Omitted ‘LazyData’ from DESCRIPTION
#>   ─  building ‘starsTileServer_0.0.0.9000.tar.gz’
#>      
#> 
#> Installing package into '/home/bart/R/x86_64-pc-linux-gnu-library'
#> (as 'lib' is unspecified)
sessionInfo()
#> R version 4.1.2 (2021-11-01)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 20.04.3 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=nl_NL.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=nl_NL.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=nl_NL.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=nl_NL.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] pillar_1.6.4       compiler_4.1.2     git2r_0.29.0       highr_0.9         
#>  [5] prettyunits_1.1.1  R.methodsS3_1.8.1  R.utils_2.11.0     remotes_2.4.1.9000
#>  [9] tools_4.1.2        pkgbuild_1.2.0     digest_0.6.28      evaluate_0.14     
#> [13] lifecycle_1.0.1    tibble_3.1.6       R.cache_0.15.0     pkgconfig_2.0.3   
#> [17] rlang_0.4.12       reprex_2.0.1       rstudioapi_0.13    cli_3.1.0         
#> [21] curl_4.3.2         yaml_2.2.1         xfun_0.28          fastmap_1.1.0     
#> [25] withr_2.4.2        styler_1.6.2       stringr_1.4.0      knitr_1.36        
#> [29] fs_1.5.0           vctrs_0.3.8        rprojroot_2.0.2    glue_1.5.0        
#> [33] R6_2.5.1           processx_3.5.2     fansi_0.5.0        rmarkdown_2.11    
#> [37] purrr_0.3.4        callr_3.7.0        magrittr_2.0.1     ps_1.6.0          
#> [41] backports_1.3.0    ellipsis_0.3.2     htmltools_0.5.2    utf8_1.2.2        
#> [45] stringi_1.7.5      crayon_1.4.2       R.oo_1.24.0

Created on 2021-11-24 by the reprex package (v2.0.1)

bart1 commented 2 years ago

Not this issue only occurs for private repositories I guess it falls back on the public interface when available

gaborcsardi commented 10 months ago

I suggest you try the pak package, it works much better with (private) git repos.