How to login into a Travis Enterprise using Travis CLI?

I have been struggling with this for several months and finally figured it out (accidentally). You can use the -X option to log into enterprise accounts. This might have always been present, but I was not aware of it.

travis login -X --github-token ${my-github-enterprise-token}

Then enter the enterprise domain when prompted and use it as the default endpoint.


Given that your Travis is hosted at travis.fewlaps.com, run

travis login -I -t your-travis-token -e https://travis.fewlaps.com/api --github-token=personal-access-token-from-githubenterprise &&
travis endpoint --set-default -e https://travis.fewlaps.com/api

...and then, to use your own Travis instead of the common one at every travis command,

travis endpoint --set-default -e https://travis.fewlaps.com/api

Remember that Travis will need that your GitHub Enterpise has the needed permissons. Right now, we're giving to that token these permissions:

  • repo (all of them)
  • admin:repo_hook
  • user

For those still struggling with this, the following helped me:

travis login --pro -X --github-token ${github-token}

Make sure you set the github token for your personal account with access to the private repos as detailed here, and create the token with the following permissions:

For private projects:

  • user:email (read-only)
  • read:org (read-only)
  • repo

for open source projects:

  • user:email (read-only)
  • read:org (read-only)
  • repo_deployment
  • repo:status
  • write:repo_hook