Full Stack Alien
Full Stack Alien

Reputation: 12501

Using Travis Ci with GitHub Pages Error: gh-token is invalid

I'm setting up my Travis Ci integration with my GitHub pages repo and I'm getting this error when committing to my dev branch, which on completion should automatically commit to my master branch.

My Error: gh-token is invalid. Details: GET https://api.github.com/user: 401 - Bad credentials // See: https://developer.github.com/v3

My git flow is as follows: I use dev as an intermediary branch. The application is using vue.js and required a production build, which the production build is what should be pushed to master.

Here is my current .travis.yml

if: branch = dev
language: node_js
node_js:
  - "lts/*"
cache:
  directories:
    - "node_modules"
script:
  - set -e
  - npm run build
deploy:
  provider: pages
  skip_cleanup: true
  github_token: GITHUB_TOKEN
  keep_history: true
  local_dir: build
  target_branch: master
  on:
    branch: dev

I've confirmed my GitHub access token and tried increasing permissions. The token I'm currently using only has public repo access, which is based on the Travis CI docs

Upvotes: 2

Views: 982

Answers (1)

StephenG
StephenG

Reputation: 2881

Might be an easy fix.

Have you tried access GITHUB_TOKEN like an environment variable?

  github_token: $GITHUB_TOKEN

Upvotes: 0

Related Questions