首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法让Github持久化- RStudio & Ubuntu 20

无法让Github持久化- RStudio & Ubuntu 20
EN

Stack Overflow用户
提问于 2022-08-21 18:53:30
回答 1查看 102关注 0票数 2

我使用的是RStudio + Github,并一直遵循下面的说明:https://happygitwithr.com/https-pat.html

它工作得很好,只是在几个小时内PAT不再工作了,我被提示输入用户名/密码。我回去生成一个新的PAT,然后重复。这是我用的密码。

代码语言:javascript
运行
复制
> usethis::create_github_token()
• Call `gitcreds::gitcreds_set()` to register this token in the local Git credential store
  It is also a great idea to store this token in any password-management software that you use
✔ Opening URL 'https://github.com/settings/tokens/new?scopes=repo,user,gist,workflow&description=DESCRIBE THE TOKEN\'S USE CASE'
> usethis::create_github_token()
• Call `gitcreds::gitcreds_set()` to register this token in the local Git credential store
  It is also a great idea to store this token in any password-management software that you use
✔ Opening URL 'https://github.com/settings/tokens/new?scopes=repo,user,gist,workflow&description=DESCRIBE THE TOKEN\'S USE CASE'
> gitcreds::gitcreds_set()


? Enter password or token: <token>
-> Adding new credentials...
-> Removing credetials from cache...
-> Done.

我还提出了以下几点:

代码语言:javascript
运行
复制
git config --global credential.helper 'cache --timeout=10000000'
EN

回答 1

Stack Overflow用户

发布于 2022-08-24 20:34:17

PAT可以作为环境变量存储,因此在key=value文件中分配~/.Renviron是一种非常可能的解决方案。

另一种方法是通过~/.Rprofile通过Sys.setenv(key="value")显式地注入它。

您可以在任何R会话中通过

代码语言:javascript
运行
复制
> v <- Sys.getenv()
> "GITHUB_PAT" %in% names(v)
[1] TRUE
> 

当您创建一个PAT (在GitHub UI中)时,您可以给它显式的生存期。我很高兴地在这个星期重复使用它,这是我一年前为一个特殊的脚本需求创建的。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73437388

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档