Devtools: install_github syntax for github enterprise with organizations

Created on 10 Aug 2015  路  2Comments  路  Source: r-lib/devtools

The institution where I work has a github enterprise installation with a number of sub-organizations set up. The R packages that we create and need to load live at URLs such as

https://github.myEnterprise.org/myOrganization/myPackage.git

I have tried a wide number of variants on the install_github() syntax but have been unable to figure out how to provide the organization name and my username for authentication. The install_github() help files indicate that username is deprecated and to provide that prior to the first slash in repo. (I'm using a token declared as GITHUB_PAT in .Renviron). I tried these:

install_github("myOrganization/myPackage.git", host="github.myEnterprise.org")
install_github("username/myPackage.git", host="github.myEnterprise.org/myOrganization")
install_github("username/myPackage.git", host="github.myEnterprise.org")
install_github("username/myOrganization/myPackage.git", host="github.myEnterprise.org")
install_github("username/myOrganization.git", host="github.myEnterprise.org")

In each case, I get these messages:

Using github PAT from envvar GITHUB_PAT
Downloading github repo _varies according to repo definition_
Error: Command failed (9)
In addition: Warning message:
Github repo contains submodules, may not function as expected! 

The github repo does not contain submodules. Here's the traceback():

9: stop("Command failed (", status, ")", call. = FALSE)
8: system_check(unzip, args, quiet = TRUE)
7: my_unzip(src, target)
6: decompress(path, outdir)
5: source_pkg(bundle, subdir = remote$subdir)
4: FUN(X[[i]], ...)
3: vapply(remotes, install_remote, ..., FUN.VALUE = logical(1))
2: install_remotes(remotes, ...)
1: install_github(_varies by example_)

Any ideas what I may be doing wrong?

_Edited to add:_ following advice I saw elsewhere, I tried options(unzip='internal'), and now I get some more verbose unzip feedback:

Error in utils::unzip(src, list = TRUE) : 
  zip file '/tmp/RtmpVv6TZL/file1275244c1281.zip' cannot be opened

However, and this may or may not be relevant, when I look in the directory indicated, /tmp/RtmpVv6TZL/, I see subdirectories named e.g. devtools12757f3f72a6, but the numeric suffix does not match the one given in the error message, and of course I'm seeing a _directory_ called devtools[suffix], not a _file_ called file[suffix].zip.

_Edited again to add:_ I see now that devtools:::parse_git_repo() is responsible for parsing the repo string, and all my username/myOrganization/myPackage.git variants above are getting interpreted as username="username", repo="myOrganization", subdir="myPackage.git", which is obviously not right in this case. However, I forked a repo so that its URL is the more expected https://github.myEnterprise.org/username/myPackage.git and I'm still getting the same error:

> devtools::install_github("username/myPackage.git", host="github.myEnterprise.org")
Using github PAT from envvar GITHUB_PAT
Downloading github repo username/myPackage.git@master
Error in utils::unzip(src, list = TRUE) : 
  zip file '/tmp/Rtmpwizhp7/file15701d503f7d.zip' cannot be opened
In addition: Warning messages:
1: Github repo contains submodules, may not function as expected! 
2: In utils::unzip(src, exdir = target) :
  error 1 in extracting from zip file

Most helpful comment

Solved. This works:

install_github("myOrganization/myPackage", host="github.myEnterprise.org/api/v3/")

In other words, "host" has to point to the github API endpoint, not to what I would naively think of as the "host". Further, including ".git" in the repo name, or "https://" in the host name causes it to break.

All 2 comments

Solved. This works:

install_github("myOrganization/myPackage", host="github.myEnterprise.org/api/v3/")

In other words, "host" has to point to the github API endpoint, not to what I would naively think of as the "host". Further, including ".git" in the repo name, or "https://" in the host name causes it to break.

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/

Was this page helpful?
0 / 5 - 0 ratings