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

install_git hangs #1498

Closed
james-atkins opened this Issue Apr 28, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@james-atkins
Contributor

james-atkins commented Apr 28, 2017

I can successfully clone a git repository running on an internal GitLab server using git2r::clone, but when attempting to install a package using devtools::install_git, the command just hangs. R doesn't respond to Ctrl-C and has to be forcefully terminated.

repo <- "git@gitlab.example.com:group/repository.git"
ssh_key <- git2r::cred_ssh_key("~/.ssh/id_rsa_gitlab.pub", "~/.ssh/id_rsa_gitlab")

# git2r::clone runs successfully
git2r::clone(repo, tempfile(), credentials = ssh_key)

# but devtools::install_git hangs
devtools::install_git(repo, credentials = ssh_key)

sessionInfo()
#> R version 3.4.0 (2017-04-21)
#> Platform: x86_64-apple-darwin16.5.0 (64-bit)
#> Running under: macOS Sierra 10.12.4
#> 
#> Matrix products: default
#> BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
#> LAPACK: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
#> 
#> locale:
#> [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_0.12.10    digest_0.6.12   withr_1.0.2     rprojroot_1.2  
#>  [5] backports_1.0.5 git2r_0.18.0    magrittr_1.5    evaluate_0.10  
#>  [9] stringi_1.1.5   rmarkdown_1.5   devtools_1.12.0 tools_3.4.0    
#> [13] stringr_1.2.0   yaml_2.1.14     compiler_3.4.0  memoise_1.1.0  
#> [17] htmltools_0.3.6 knitr_1.15.1
@jimhester

This comment has been minimized.

Member

jimhester commented Apr 28, 2017

ssh is probably trying to prompt for your credentials, try using ssh-agent to cache them.

@pooranis

This comment has been minimized.

pooranis commented May 7, 2017

I had the same problem. In the source code, the install_remote function doesn't pass the credentials to remote_sha.git_remote (or actually, remote_sha.git_remote doesn't pass it to git2r::remote_ls), so the function just hangs. They do get passed through remote_download.git_remote to git2r::clone. Could this be changed to be consistent or is this a problem with git2r?

If the ssh key is not the default, then you would have to pass the credentials. I'm not sure how to cache them with ssh-agent from within Rstudio. So, if that's a better solution than changing the function, does anyone have any pointers?

@james-atkins

This comment has been minimized.

Contributor

james-atkins commented May 8, 2017

Yes looks like @pooranis is right and the credentials are not passed to git2r::remote_ls. I've submitted a pull request which should fix this: #1501.

@jimhester jimhester closed this in 68d2343 May 17, 2017

@lock

This comment has been minimized.

lock bot commented Sep 18, 2018

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Sep 18, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.