travis.rb: Travis Login Fails

I cannot login using the travis CLI. I looked around and this seems to be a know issue, but I really couldn’t be sure! 🤷🏻‍♂️

Here is the travis report --pro:

System
Ruby:                     Ruby 3.0.0-p0
Operating System:         macOS 11.1
RubyGems:                 RubyGems 3.2.3

CLI
Version:                  1.10.0
Plugins:                  none
Auto-Completion:          yes
Last Version Check:       2021-01-14 10:06:58 +0100

Session
API Endpoint:             https://api.travis-ci.com/
Logged In:                no
Verify SSL:               yes
Enterprise:               no

Endpoints
com:                      https://api.travis-ci.com/ (current)
org:                      https://api.travis-ci.org/ ()

Last Exception
An error occurred running `travis login --pro`:
    RuntimeError: Not Found
        from /usr/local/Cellar/travis/1.10.0_2/libexec/gems/travis-1.10.0/lib/travis/tools/github.rb:212:in `rescue in basic_auth'
        from /usr/local/Cellar/travis/1.10.0_2/libexec/gems/travis-1.10.0/lib/travis/tools/github.rb:208:in `basic_auth'
        from /usr/local/Cellar/travis/1.10.0_2/libexec/gems/travis-1.10.0/lib/travis/tools/github.rb:216:in `login'
        from /usr/local/Cellar/travis/1.10.0_2/libexec/gems/travis-1.10.0/lib/travis/tools/github.rb:81:in `possible_tokens'
        from /usr/local/Cellar/travis/1.10.0_2/libexec/gems/travis-1.10.0/lib/travis/tools/github.rb:50:in `each_token'
        from /usr/local/Cellar/travis/1.10.0_2/libexec/gems/travis-1.10.0/lib/travis/tools/github.rb:37:in `with_token'
        from /usr/local/Cellar/travis/1.10.0_2/libexec/gems/travis-1.10.0/lib/travis/cli/login.rb:31:in `login'
        from /usr/local/Cellar/travis/1.10.0_2/libexec/gems/travis-1.10.0/lib/travis/cli/login.rb:50:in `run'
        from /usr/local/Cellar/travis/1.10.0_2/libexec/gems/travis-1.10.0/lib/travis/cli/command.rb:200:in `execute'
        from /usr/local/Cellar/travis/1.10.0_2/libexec/gems/travis-1.10.0/lib/travis/cli.rb:64:in `run'
        from /usr/local/Cellar/travis/1.10.0_2/libexec/gems/travis-1.10.0/bin/travis:18:in `<top (required)>'
        from /usr/local/Cellar/travis/1.10.0_2/libexec/bin/travis:23:in `load'
        from /usr/local/Cellar/travis/1.10.0_2/libexec/bin/travis:23:in `<main>'


For issues with the command line tool, please visit https://github.com/travis-ci/travis.rb/issues.
For Travis CI in general, go to https://github.com/travis-ci/travis-ci/issues or email support@travis-ci.com.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 7
  • Comments: 15 (1 by maintainers)

Most upvoted comments

@Rubix982 I was able to login with 2FA by using a Github Personal access token and passing it via

travis login --com --github-token TOKEN

+1. Broken for me as well. I can’t do ssh --generate because of it

travis login --com --github-token TOKEN

i can’t appreciate you any more! i succeed in logining in by token successfully,but i still fail to login in by my username and password.

I was able to fix my issue by changing the repository endpoints in my ~/.travis/config.yml file.

I had recently started using travis-ci.com instead of travis-ci.org (since the latter is shutting down), but the CLI needs to know that, too. So in the aforementioned config file, under repos/<repo-name>/endpoint, I changed them all from https://api.travis-ci.org/ to https://api.travis-ci.com/.

Note that I still needed to do this even though I had already changed the default_endpoint to https://api.travis-ci.com/.

Hello!

I’m running into the same set of issues.

I realized that I have 2FA activated for my account, and the way that the travis login handles api.github.com is through an HTTPS endpoint.

This error also occurs to me when I try to push to a GitHub repository with the remote set to HTTPS instead of my SSH keys. That is to say, due to the recent changes that Github wants to deprecate the git CLI for the simple HTTPS login feature, in favor of the permission key generated as per security grants on the repository

It would be a better move to let us, and a possible solution as well to circumvent this, that we could somehow feed travis login the SSH file key that is authenticated against the account for login verification.

Another partial helping method would be to generate a more helpful error message that lets the user know whether the error was due to the 2FA issue, or something else. Currently, the error logs generated are not helpful to trace the problem too.

For the record, one of the current options available via --help was sshkey, but I’m assuming this has something to do with a .travis.yml at root and pushing config files, but a pre-requisite to that is login, which is a blocker to all the other options at the moment.