r-lib / gert

Simple git client for R
https://docs.ropensci.org/gert/
Other
146 stars 31 forks source link

Access token as string not working for enterprise Github and Gitlab #145

Open maximilianmordig opened 3 years ago

maximilianmordig commented 3 years ago

https://github.com/r-lib/gert/blob/3d5e13b3ba75acdd32c7efe3457a90b7806f7106/R/fetch.R#L48

Calling

gert::git_clone(
      url = "https://github.company.com/repo1", path = ".", password = "accessToken"
    )

does not work because the username is not provided to make_cred_cb (NA). By changing https://github.com/r-lib/gert/blob/3d5e13b3ba75acdd32c7efe3457a90b7806f7106/R/credentials.R#L40 to username <- "git", this works with on-premise GitHub. However, it does not work with on-premise Gitlab, where it fails with:

Error in libgit2::git_clone : 
  server requires authentication that we do not support

git2r::clone supports both via git2r::cred_token.