安装失败:错误的凭证(401),特拉维斯CI为R
问题描述:
我.travis.yml如下:安装失败:错误的凭证(401),特拉维斯CI为R
language: r
sudo: required
cache: packages
before_install:
- echo -e "machine github.com\n login $CI_USER_TOKEN" >> ~/.netrc
- chmod 755 ./travis-tool.sh
install:
- ./travis-tool.sh install_github RcppCore/Rcpp
- ./travis-tool.sh install_github rstats-db/DBI
- ./travis-tool.sh install_github rstats-db/RPostgres
不过,我不能够安装RCPP包。它抛出以下错误
+InstallGithub RcppCore/Rcpp
+EnsureDevtools
+Rscript -e 'if (!("devtools" %in% rownames(installed.packages()))) q(status=1)'
+echo 'Installing GitHub packages: RcppCore/Rcpp'
Installing GitHub packages: RcppCore/Rcpp
+Rscript -e 'devtools::install_github(commandArgs(TRUE),host = '\''https://api.github.com'\'', dependencies = FALSE)' RcppCore/Rcpp
Using GitHub PAT from envvar GITHUB_PAT
Downloading GitHub repo RcppCore/[email protected]
from URL https://api.github.com/repos/RcppCore/Rcpp/zipball/master
Installation failed: Bad credentials (401)
我从github
复制travis-tools.sh文件中的任何帮助表示赞赏
答
不知道为什么的.netrc方法没有工作(可能R-客户端只是忽略它不像卷曲),但根据documentation,使用install_github
登录的正确方法是设置GITHUB_PAT
环境变量。也许是这样的:
env:
- GITHUB_PAT=$CI_USER_TOKEN
基本上,你的日志表明,GITHUB_PAT
用于登录尝试:
+ RSCRIPT -e 'devtools :: install_github(commandArgs(TRUE),主机=' \ '' https://api.github.com '\' '依赖= FALSE)' RcppCore/RCPP
从ENVVAR使用GitHub的PAT GITHUB_PAT
可以将我阅读这篇文章:https://www.r-bloggers.com/using-travis-make-sure-you-use-a-github-pat/
我能够在我的电脑和码头使用相同的命令安装包。 –
您是否在Docker /计算机上使用修改的'〜/ .netrc'登录? – dk14
此外,我注意到“GITHUB_PAT”(env变量)用于登录,所以可能发生.netrc被忽略,只是猜测 – dk14