Open JackCaster opened 2 months ago
I opened an issue in the usethis
repo to improve the doc on their side too: https://github.com/r-lib/usethis/issues/2051
It could probably be made more clear, but renv
is differentiating between "github" remotes and plain "git" remotes here. It looks like you're using "github" remotes here?
When installing packages from GitHub using the "github" remote style, e.g. renv::install("user/repo")
, we explicitly set an Authorization header with the relevant access token. This is retrieved either from the GITHUB_PAT
environment variable, or (if it's installed) the gitcreds
package, which we use to request the relevant credentials.
Packages from git
remotes are typically installed using something like renv::install("git::git@github.com:user/repo.git")
. In this scenario, renv
uses git
from the command line to fetch the required sources. In this case, having authentication keys set up should make the process smoother, since git
can then handle everything for us behind the scenes. This is where the recommendation for SSH + available keys comes from.
Thanks! True, I may confuse git and Github. And yes, in this specific case I mean a Github repository!
When installing packages from GitHub using the "github" remote style, e.g. renv::install("user/repo"), we explicitly set an Authorization header with the relevant access token. This is retrieved either from the GITHUB_PAT environment variable, or (if it's installed) the gitcreds package, which we use to request the relevant credentials.
This is where I am confused. I can install remote packages, despite not having GITHUB_PAT nor gitcreds. But I do have my credentials in the credential manager stored via the browser authentication (if I do install gitcreds, they will be shown). That warning message by renv should perhaps not be shown in this scenario?
I can install remote packages, despite not having GITHUB_PAT nor gitcreds. But I do have my credentials in the credential manager stored via the browser authentication (if I do install gitcreds, they will be shown). That warning message by renv should perhaps not be shown in this scenario?
It's possible, but my guess is that you might run into GitHub API rate limits since renv
isn't seeing your tokens in this scenario. (Unless you're using a private GitHub repository, in case I'm obviously wrong!)
I am confused on how ´renv´ deals with packages stored in remote repositories (e.g., Github).
I use Git with SSH keys, but I also have my credentials stored in the
git-credential-manager
. I do not have the env variableGITHUB_PAT
set. Regardless, I can push/commit and use the GH API without problems.However, when I install a remote package in a fresh environment, renv seems to complain that it cannot find any Github credentials and yet packages are installed (without PAT or package
gitcreds
):Is this the intended behavior?
The documentation on how to set up the Github credentials is a bit confusing, I admit. For example, here. you seem to recommend the use of
GITHUB_PAT
, here reads like username + password is recommended, but then you also writeFinally, it is not mentioned that you can authenticate to Github via browser when using git-credential-manager, without the need of creating a PAT first. This makes things much easier.