Installing non-public packages from Gitlab using devtools::install_git

后端 未结 3 520
余生分开走
余生分开走 2020-12-08 04:49

My institution recently installed GitLab for us. I\'ve figured out how to install R packages from the GitLab server using devtools::install_git and it works as

3条回答
  •  孤城傲影
    2020-12-08 05:04

    I'd highly recommend going the SSH route, and the below works for that. I found making the leap to SSH was easy, especially with R and RStudio. I'm using Windows in the below example. Edits from code I use in practice are in all caps.

    creds = git2r::cred_ssh_key("C:\\Users\\MYSELF\\.ssh\\id_rsa.pub",
                                "C:\\Users\\MYSELF\\.ssh\\id_rsa")
    devtools::install_git("git@gitlab.WORKDOMAIN.com:GITLABGROUP/PACKAGE.git",
                          credentials = creds)
    

    Two quick additional comments:

    • git2r is imported with devtools, you shouldn't need to install it separately.
    • Also I don't think this should need mentioning, but passwords in plaintext in your script is a very bad idea.

提交回复
热议问题