Installing a Gitlab Package in a renv project


in a renv project, when I try to install any R package from our company GitLab repository with

remotes::install_git(url = "url/of/our/gitlab/repo",  credentials = git2r::cred_token(token = "GITLAB_PAT"))

I get the error:

Error: Failed to install 'unknown package' from Git:
Line starting '<!DOCTYPE html> ...' is malformed!

Similarly, with


I get

Error in read.dcf(file, ...) :
Line starting '<!DOCTYPE html> ...' is malformed!

The installation works correctly when renv is deactivated.

I am using these packages and R version:

  • renv 0.13.2
  • remotes 2.4.0
  • git2r 0.28.0
  • R 4.0.2 on Red Hat Enterprise Linux Server 7.5

Thank you

This may be better suited for a Github issue (I can't track the error down), but it does look like you have to set the repo: Introduction to renv • renv

Is your GITLAB_PAT actually set within your renv project? (How do you normally set it?) I can't think of any other reason why this would fail in an renv project but succeed otherwise.

My GITLAB_PAT is set within an .Renviron file in my home directory. If I run Sys.getenv("GITLAB_PAT") from within the renv project, I get the correct value.

After some attempts, it looks like remotes::install_git() correctly installs the Gitlab package if I use the previous remotes version 2.3.0. With remotes version 2.4.0, I get the error. And this seems to happen both within and outside of the renv project.

If that's the case, then I recommend filing an issue: Issues · r-lib/remotes · GitHub

For now, you could continue using the older version of remotes.

1 Like

I found an open remotes issue and a related pull request probably addressing the same error I had.

I'll wait for the merge and file a new issue if that doesn't remove the error in my use case.

Thank you!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.