Reputation: 3865
My .travis.yml is as follows:
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
However, I am not able install Rcpp package. it is throwing following error
+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/Rcpp@master
from URL https://api.github.com/repos/RcppCore/Rcpp/zipball/master
Installation failed: Bad credentials (401)
I copied travis-tools.sh file from github
Any help is appreciated
Upvotes: 2
Views: 898
Reputation: 22374
Can't tell why .netrc approach didn't work (probably R-client just ignores it unlike curl), but according to documentation, the right way to login using install_github
is to set GITHUB_PAT
environment variable. Perhaps, something like:
env:
- GITHUB_PAT=$CI_USER_TOKEN
Basically, your log suggests that GITHUB_PAT
was used for login attempt:
+Rscript -e 'devtools::install_github(commandArgs(TRUE),host = '\''https://api.github.com'\'', dependencies = FALSE)' RcppCore/Rcpp
Using GitHub PAT from envvar GITHUB_PAT
You can also read this article: https://www.r-bloggers.com/using-travis-make-sure-you-use-a-github-pat/
Upvotes: 2