When I try to install from a private repository our own Gitlab CE server with
remotes::install_gitlab(repo = "username/reponame", host = "git.hostname.tld")
I get the following error
Error in utils::download.file(url, path, method = download_method(), quiet = quiet, :
cannot open URL 'https://git.hostname.tld/username/reponame/repository/archive.tar.gz?ref=master&private_token=GITLAB_PAT'
GITLAB_PAT is set in scope "api" (read/write access to the API) and "read_repository" (Grants read-only access to repositories on private projects using Git-over-HTTP (not using the API).)
download.file('https://git.hostname.tld/username/reponame/repository/archive.tar.gz?ref=master&private_token=GITLAB_PAT', destfile = "archive.tar.gz")
gives an "HTTP status was '401 Unauthorized'" error.
Using the corresponding API URL instead works fine:
download.file("https://git.hostname.tld/api/v4/projects/username%2Freponame/repository/archive.tar.gz?ref=master&private_token=GITLAB_PAT", destfile = "archive.tar.gz")
Long story short: Has anyone gotten install_gitlab to work with a private repo and can give me a hint what has gone wrong with my attempts above?
Update: I just tried with a private repo on gitlab.com and I get the same error.
Update2: The main issue seems to be that the repository is private, irrespective of whether the server is gitlab.com or a gitlab CE or EE server. I updated the text accordingly.