`Travis login ` error despite I set `github_token` in .yml


this is a tip to make me go to http://github.com/settings/tokens. But I set github_token in Travis. I don’t know why appear this error. The command only want me to write username and password of github.
And I try travis encrypt --pro . But the command still appear error.

who can resolve the problem

other info:
centos: 7
ruby: 2.7.1
API Endpoint: https://api.travis-ci.com/

The first error message is pretty clear: the username/password pair is incorrect.

Setting a secret token in .travis.yml won’t help here: travis CLI cannot decrypt it (since the decryption key is the private key and is only available to Travis build machinery).

The 2nd error message means that travis couldn’t autodetect the Travis project to use the public key from and you need to specify its repo slug manually (-r user/repo). This happens if you run this command not in a project’s directory but in this case, it’s likely because you ignored the login error (so it would fail in the end anyway) since it couldn’t retrieve your list of projects for the autodetection.

No.I can insure my username and password of github is correct. But the error still appear.And I use travis login --com ---github-token * resolve the problem.

@dreamYouchen,

There are some occasions where you may need a new token from GitHub if this is the login method you are using.

I think there is an unexpected change in GitHub API. I’m looking into it.

(Unexpected by the current release of the CLI.)

I will point out that this issue is not unique to our situation; Octokit also exhibits it:

$ pry

[1] pry(main)> require 'octokit'
=> true
[2] pry(main)> cli = Octokit::Client.new(login: 'BanzaiMan', password: ENV['GITHUB_PASSWORD'])
=> #<Octokit::Client:0x00007fac6e1926f8 ...>
[3] pry(main)> cli.user
Octokit::Unauthorized: GET https://api.github.com/user: 401 - Bad credentials. The API can't be accessed using username/password authentication. Please create a personal access token to access this endpoint: http://github.com/settings/tokens // See: https://docs.github.com/articles/creating-a-personal-access-token-for-the-command-line
from /Users/asari/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/octokit-4.19.0/lib/octokit/response/raise_error.rb:16:in `on_complete'
1 Like