I have a local GitLab account with an R package that can be installed by:
devtools::install_git(
url = "http://my-gitlab/my-projects/package",
credentials = git2r::cred_user_pass("user", "pass")
)
When I run renv::init()
the package source is unknown. The getting started article does give details about how to setup functions to deal with private repos but I can't figure it out for GitLab when using devtools
and git2r::cred_user_pass
. I could store GIT_USER
and GIT_PASSWORD
in an .Renviron
file but I'm not sure how to force the init
function to user devtools::install_git
with those credentials. I did try but then I get an error:
fatal: could not read Username for 'http://my-gitlab': No such device or address
All the example options they provide use a GitLab token for authentication:
# use a named list directly
options(renv.auth = list(
MyPackage = list(GITHUB_PAT = "<pat>")
))
Perhaps there is a better way to install from a local GitLab repo that will work better with renv
?
For anyone else having the same problem, this worked for me (see here):
api
. Note: I'm not sure this has to be 'api' I didn't check all options but it worked for meSys.setenv(GITLAB_PAT = <...>)
options(renv.config.gitlab.host = "http://my-gitlab-server")
. Note: I had to include "http://" to get it working.renv::install("gitlab::project/package")
renv::install("gitlab@my-gitlab-server::project/package")