r-lib / credentials

Tools for Managing SSH and Git Credentials
https://docs.ropensci.org/credentials
Other
72 stars 5 forks source link

Set GitHub PAT permanently on AWS-Lightsail #18

Closed Tazinho closed 3 years ago

Tazinho commented 3 years ago

I am using credentials::set_github_pat() on AWS-Lightsail (Ubuntu, personal User) and it works basically fine.

However, when I restart the instance, RStudio asks me again for PW/User.

Also if I run credentials::set_github_pat() after restart, I am getting asked for the PAT again.

Is there a way around this and set the PAT permanently? What could be the issue?

Edit: Also writing credentials::set_github_pat() into .Renviron as recommended in this blogpost https://ropensci.org/blog/2020/07/07/github-pat/ doesn't solve this and instead leads to the following error msg. in RStudioServer after a reboot.

grafik

jeroen commented 3 years ago

You need to set a credential helper other than cache.

Op di 3 aug. 2021 15:48 schreef Malte Grosser @.***>:

I am using credentials::set_github_pat() on AWS-Lightsail (Ubuntu, personal User) and it works basically fine.

However, when I restart the instance, RStudio asks me again for PW/User.

Also if I run credentials::set_github_pat() after restart, I am getting asked for the PAT again.

Is there a way around this and set the PAT permanently? What could be the issue?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/r-lib/credentials/issues/18, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABUZ7Y5X4OH66LV72WULH3T27XR3ANCNFSM5BO4DWWQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

jennybc commented 3 years ago

This is a tricky problem (which I have also encountered on RStudio Server), because linux doesn't have an OS-level store like macOS Keychain or Windows Credential Manager. I think you might need to use the .Renviron solution.

But it sounds like you're mis-implementing that. .Renviron can only contain a NAME=VALUE type of entry for storing your PAT in an env var. Whereas your error message makes it look like you're trying to run R code from .Renviron, which you can't. (That can happen in .Rprofile.)

Tazinho commented 3 years ago

Thanks to both of you!

Setting credentials::credential_helper_set("store") indeed solved the issue in my case.