【问题标题】:How to install R package from private repo using devtools install_github?如何使用 devtools install_github 从私有仓库安装 R 包?
【发布时间】:2014-02-05 21:53:52
【问题描述】:

我正在尝试从我的 github 存储库安装示例包: https://github.com/jpmarindiaz/samplepkg

我可以在 repo 公开时通过 R 解释器使用以下任何命令安装它:

  • install_github("jpmarindiaz/rdali")
  • install_github("rdali",user="jpmarindiaz")
  • install_github("jpmarindiaz/rdali",auth_user="jpmarindiaz")

但是当 git 存储库是私有的时,我得到一个错误:

Installing github repo samplepkg/master from jpmarindiaz
Downloading samplepkg.zip from     
https://github.com/jpmarindiaz/samplepkg/archive/master.zip
Error: client error: (406) Not Acceptable

我还没有弄清楚当 repo 是私有的时身份验证是如何工作的,有什么提示吗?

【问题讨论】:

  • 只是猜测,您是否尝试设置密码参数?
  • 听起来不错!
  • @agstudy 我真正讨厌的是,我必须以明文形式输入密码(最终它会保存在.Rhistory 中)。任何想法如何避免这种情况?
  • @agstudy 哈哈我怎么会错过它……最好不要以明文形式输入密码!
  • @Beasterfield & jpmarindiaz 我没有要测试的私有存储库,但我会克隆我的存储库,使用git clone 或更好地手动使用Rstudio(从现有的 git 创建一个新包repository) ,然后你使用来自 `devtools. 的install() 安装。

标签: r github devtools


【解决方案1】:

您是否尝试过设置个人访问令牌 (PAT) 并将其作为 install_github()auth_token 参数的值传递?

请参阅底部的?install_github(包devtools 版本1.5.0.99)。

【讨论】:

【解决方案2】:

在以下位置创建访问令牌: https://github.com/settings/tokens

检查你的仓库是否有master 分支,否则使用main

devtools::install_github("user/repo"
                         ,ref="main"
                         ,auth_token = "tokenstring"
                         )

【讨论】:

    猜你喜欢
    • 2017-02-01
    • 2020-01-31
    • 1970-01-01
    • 2019-04-03
    • 1970-01-01
    • 2018-05-02
    • 2020-09-23
    • 1970-01-01
    相关资源
    最近更新 更多