r-lib / gitcreds

Query git credentials from R
https://gitcreds.r-lib.org/
Other
25 stars 10 forks source link

`gitcreds_set()` should check to make sure a credential helper is configured #54

Open tanho63 opened 9 months ago

tanho63 commented 9 months ago

Hi! Fresh-starting a machine and was following the usethis guide, but ran into an issue where I forgot to set the credential helper to something before trying to set credentials via gitcreds::gitcreds_set():

R> gitcreds::gitcreds_list_helpers()
Error in new_git_error("git_error", args = args, stdout = out, status = attr(out,  : 
  System git failed: 
R> gitcreds::gitcreds_set()

? Enter password or token: my_github_token
-> Adding new credentials...
-> Removing credentials from cache...
-> Done.
R> gitcreds::gitcreds_get()
Error in throw(new_error("gitcreds_no_credentials", url = url)) : 
  Could not find any credentials

Should gitcreds_set() check to make sure at least one credential helper is configured before trying to set the credential?

gaborcsardi commented 9 months ago

That would indeed make sense. I have a feeling that this won't be easy to implement, but we should at least investigate.