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.