remotes icon indicating copy to clipboard operation
remotes copied to clipboard

Error: package installation from azure devops repository

Open sivadna opened this issue 4 years ago • 7 comments

we maintain internal R package in Azure devops repository, and package installation in R fails with Network is unreachable error.

 library(devtools)
 library(httr)
 set_config(use_proxy(url = 'proxyserver', port = 8080))
 gitcred <- git2r::cred_user_pass('ado user id', 'ado token')
 install_git('ado repository url', credentials = gitcred)
Error: Failed to install 'unknown package' from Git:
Error in 'git2r_remote_ls': failed to connect to dev.azure.com: Network is unreachable

install_git() was working fine until July 2019 and broke since then. Could you guide if there are any devtools function can be used to install packages from Azure devops?

sivadna avatar Sep 18 '19 13:09 sivadna

It looks to me like you are missing the protocol, are you passing it to install_git()?

jimhester avatar Sep 20 '19 19:09 jimhester

Yes, below is the sample azure devops url -

install_git('https://[email protected]/TeamName/ProjectName/_git/PackageName',
credentials = gitcred)

sivadna avatar Sep 23 '19 06:09 sivadna

I'm doing something similar. I want include an internal package that's hosts on devops as a dependency of another internal package. I can install it from devops with the following, so that the PAT I use for authentication in git is used.

    remotes::install_git(url, git = "external")

ryanbthomas avatar Apr 13 '20 16:04 ryanbthomas

I am able to install from a private Azure DevOps repo using remotes version 2.2.0. Note that if you are using a PAT token you can't use credentials = git2r::cred_token() because you need to supply a username.

Authenticate Access with Personal Access Token: Git interaction require a username, which can be anything except the empty string. The PAT is used as the password.

gitcred <- git2r::cred_user_pass('SomeString', 'PAT')
remotes::install_git(
    "https://dev.azure.com/YourOrganization/YourProject/_git/YourRepo",
    credentials = gitcred
)

Authenticate Using External Git Client

remotes::install_git(
    "https://dev.azure.com/YourOrganization/YourProject/_git/YourRepo",
    git = "external"
)

natbprice avatar Nov 25 '20 16:11 natbprice

It would be great to have a fully supported version of this for ADO.

remotes::install_git() works inconsistently for packages hosted in ADO. I have one package which installs just fine using the git2r::cred_user_pass() along with the remotes::install_git(). Another one which fails using the same exact code (different repo url hosted in same project) with opaque error

Error : Failed to install 'unknown package' from Git:
  Error in 'git2r_remote_ls'

git2r::remote_ls() succeeds when ran locally. So this is a very difficult problem to debug.

JosiahParry avatar Sep 13 '22 15:09 JosiahParry

@JosiahParry did you find a solution to your ADO error (Error in 'git2r_remote_ls')?

mkearney avatar Jan 23 '23 15:01 mkearney

@mkearney i don't have the code anymore since i'm no longer with the organization. but the code was essentially (pseudo-ish) the below.

What I did was create a temporary directory, clone the repo, install from source, and then delete the temporary directory.

tmp <- tempdir()
git2r::clone("url-of-the-repo", tmp)
install.packages(tmp, repos = NULL
unlink(tmp)

JosiahParry avatar Jan 23 '23 15:01 JosiahParry