Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cached gitcreds, if available #106

Closed
wants to merge 2 commits into from
Closed

Use cached gitcreds, if available #106

wants to merge 2 commits into from

Conversation

jeroen
Copy link
Member

@jeroen jeroen commented Nov 21, 2020

To summarise: the status quo of https authentication in gert is:

  1. Try the GITHUB_PAT envvar if the host is github.com
  2. Otherwise, query the git credential store via credentials for a login for the given host (for example GHE).
  3. Otherwise prompt the user if possible.

With this PR, what we gain is:

  1. (b) If a GITHUB_PAT_BERKELEY_EDU var has been set by gitcreds and we are pushing to BERKELY_EDU we will try to use credentials from this variable. This saves us 1 call to the git credential store.

R/credentials.R Outdated Show resolved Hide resolved
# Try looking for (cached) gitcreds, mainly to support GHE
# This should never cause a prompt! It either returns creds or errors.
if(requireNamespace('gitcreds')){
creds <- tryCatch(gitcreds::gitcreds_get(url, set_cache = FALSE), error = function(e){})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like allowing set_cache = TRUE (the default) would be OK or maybe even desirable?

Copy link
Member Author

@jeroen jeroen Nov 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit worried about saving any password found in the store as plain text env-var, as a side effect of pushing to git. My intention was just to use the GITHUB_PAT_BERKELEY_EDU variable if it exists.

Co-authored-by: Jennifer (Jenny) Bryan <jenny.f.bryan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants