14

I'm trying to login to an own hosted Travis Enterprise, but usual travis login and travis login --pro are trying to login to usual Travis SAAS environment

3 Answers 3

28

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
7
  • 1
    Thanks. This made my Friday!
    – pushkarnk
    Feb 3, 2017 at 9:30
  • Nice! I wrote it at StackOverflow to remember it to me of the future... and also to you! :·D Mar 21, 2017 at 14:57
  • @RocBoronat Does this still work for you? I tried your instructions, and while I could login, it did not save my credentials (github.com/travis-ci/travis.rb/issues/588)
    – arewm
    Mar 15, 2018 at 12:26
  • @arewm sorry, but now I don't use Travis anymore, so I can't try it again. Mar 16, 2018 at 12:57
  • 1
    @RocBoronat No problem. I had someone else from my company try logging in. There is just something bizarre with my computer apparently...
    – arewm
    Mar 21, 2018 at 16:58
11

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
3

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.

1
  • For enterprise Travis with enterprise GitHub, I had to specify the Travis domain: travis login -e "https://travis.example.com/api" -X --github-token ...
    – Leo
    Jan 28, 2019 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.