Closed lcolladotor closed 3 years ago
Yes, on Linux you often don't have a proper credential store, especially on a server. In your case
> gitcreds::gitcreds_list_helpers()
[1] "cache"
means that you are using the cache
credential helper: https://git-scm.com/docs/git-credential-cache
This credential helper stores the credentials in memory, so they are lost after a reboot. It also has a timeout, defaulting to 900 seconds.
If you can use an .Renviron
file on RStudio server, then it is probably simplest to set up the token as an environment variable in .Renviron
. You can set GITHUB_PAT_GITHUB_COM
or just GITHUB_PAT
, and gitcreds (and thus usethis, etc.) still picks these up.
Thank you very much for the explanation Gábor!
Best, Leo
NP, we'll try to explain this better in the gitcreds and/or usethis docs.
Hi,
I'm having a bit of a problem with
gitcreds
on an RStudio Server 1.4.1103 that I'm using for teaching a class this week. I'm able to create a GitHub token and store it withgitcreds
.I can change R projects, restart R, and well, I get the same info back from
gitcreds::gitcreds_get("https://github.com")
.However, at some point, I'm no longer able to retrieve the information. It's almost like wherever the token is cached gets deleted. Is there a way to find what would the cache location be? I haven't been able to figure out what triggers the break in behavior. I mean, after
gitcreds::gitcreds_set()
I really only use commands likeusethis::use_github()
and none of thegitcreds
commands.After reading https://gitcreds.r-lib.org/reference/gitcreds_get.html#arguments (
Credential helpers
section) I see thatbut most Linux distributions do not set up a default credential helper.
which makes me guess that at some point the environment variableGITHUB_PAT_GITHUB_COM
gets un-set. For now I told students to useusethis::edit_r_environ()
although I'm aware that this is no longer the suggested setup. Though hmm, maybe I'm missing something else that could be done to getgitcreds
working on this linux environment.(at some point this happens:)
Let me know if there's any other information I can provide that would be useful.
Best, Leo
Related to https://github.com/lcolladotor/rnaseq_LCG-UNAM_2021/commit/e15bb0f32d1b189b565b446b4e20a347c0ef0ecf.