GitHub returns 401 (Unauthorized) when I'm deploying to GitHub releases



I’m using Travis CI on a public GitHub repo and deploying files to GitHub releases, when I’m setting up the deployment, I simplify use this command:

$ travis setup --org --force

and follow up the wizard.
It creates a personal token on GitHub and deployment codes in .travis.yml:

  name: ${VERSION}
  body: Relaese body
  prerelease: true
  provider: releases
    secure: rvV6A3CK...kGi0=
  file: app/build/outputs/apk/release/app.apk
    repo: Trumeet/MiPushTester

You can view it on GitHub
Unfortunately, the build always says Unauthorized:

Installing deploy dependencies
invalid options: -SHN
(invalid options are ignored)
Successfully installed .....
Preparing deploy
No stash entries found.
/home/travis/.rvm/gems/ruby-2.4.1/gems/octokit-4.6.2/lib/octokit/response/raise_error.rb:16:in `on_complete': GET 401 - Bad credentials // See: (Octokit::Unauthorized)

I have no idea about this, could everyone help me? Thanks.


You need to set skip_cleanup: true; otherwise your build artifacts will be deleted before deployment. See


Thanks for your quick reply, but I’ve tried your solution and it breaks down with the same error.
The updated .travis.yml:

  name: ${VERSION}
  body: ...body is ignored
  prerelease: true
  provider: releases
  skip_cleanup: true
    secure: rvV6A3...Gi0=
  file: app/build/outputs/apk/release/app.apk
    repo: Trumeet/MiPushTester


Thanks for the info.

I now see that you are running your builds on This necessitates that you pass --pro flag when you are interacting with travis CLI. Try running

travis encrypt -r Trumeet/MiPushTester --pro

to encrypt your API key, and replacing the secure key-value pair.


Sorry, I’m using .org, not .com, here is my build logs URL:


Are there anybody wants to give me a hand? :cry:


On .org, your build is failing, so no deployment occurs.

On .com, your build succeeds, but deployment fails.


Thanks a lot, I confused org and com, and added environment variables to the wrong way :grinning: