401 - Bad credentials Travis
flofriday opened this issue · comments
I don't like writing an issue here and bore you but I spend the whole day with 22 releases and everyone failed. I simply don't know what to do at this point.
What I did
- copy the trust files in my repository https://github.com/flofriday/thumbcloud
- changing some build options
- create the appveyor encrypted key with my github token -> and appveyor works perfectly which means my github token must work
- create the travis encrypted key with
travis encrypt bd2XXXXXXX46f
-> travis fails everytime at deployment withGET https://api.github.com/user: 401 - Bad credentials
https://travis-ci.com/flofriday/thumbcloud/jobs/128447592
I also tried:
travis encrypt bd2XXXXXXX46f -r flofriday/thumbcloud
travis encrypt -r flofriday/thumbcloud -org
like recommended here: travis-ci/travis-ci#8128 which gives a prompt to enter the key, however exiting with CTRL - D didn't worked on my windows machine- Inserting the key with and without
"
travis encrypt bd2XXXXXXX46f --add
travis encrypt bd2XXXXXXX46f --add deploy.api_key
It took me 27 releases but I got it.
I had to type travis encrypt bd2XXXXXX46f --pro
(bd2XXXXXX46f is my github token).
Little bit of backstory:
Originally travis was split in travis-ci.org for opensource and travis-ci.com for paid private project. However in may 2018 they decided to move to travis.com only. So when I signed up to travis I got an travis-ci.com account, but the commandline tool https://github.com/travis-ci/travis.rb was last updated in march and so it doesn't know that the two domains are now united.
Therefore, the tool assumed that my opensource project is on .org which is wrong and with travis encrypt --pro
you can force the .com domain.
However, I am not sure if this is the reason it didn't worked, it is just the only explanation I can think of. Please correct me if I am wrong.
Add this to .travis.yml
Maybe it would be a good idea to add to .travis.yml
something like:
deploy:
# TODO update `api_key.secure`
# - Create a `public_repo` GitHub token. Go to: https://github.com/settings/tokens/new
# - Encrypt it: `travis encrypt 0123456789012345678901234567890123456789`
# Note: If your project is on travis-ci.com you need to add the --pro flag like so:
# `travis encrypt 0123456789012345678901234567890123456789 --pro`
# - Paste the output down here
api_key:
@flofriday Thanks! It solved my issue, too. This could be added to the documentation of travis-ci
or to StackOverflow
for future reference.
Now I understand it. We should choose --org
or --pro
(travis.com) at first. Based on the full conversion from org
to com
, so I used --pro
. I manually turned off the services of org
, then the releases never result in a bad credential now.
@flofriday Maybe this doc would help a little. Seemingly there will be a full transit from org
to pro
.
I created the PR #105, and I will leave this issue open for now until the problem is fixed, so future users can find the solution faster.
@psychelzh yes if found the document helped once I found out that --pro
fixed my problem, but until that moment it wasn't clear to me that my problem and the transit where connected.
As the doc points out the decision for the transit took place on May 2nd, 2018 however the CLI travis tool was last updated on February 12, 2018 (as you can see here. So the tool just doesn't know about this move to travis-ci.com. Personally I really hope that they will update their tool so it can auto-detect between .com and .org.
Just had this issue and had the wrong permission on my personal token. It's successfully building with these permissions: user:email
, read:org
, repo_deployment
, repo:status
, write:repo_hook
and I added repo_public
because mine is a public repo.