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
- 11,395
- 5
- 47
- 59
3 Answers
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
To use your own Travis, instead of the common one, for future travis commands
travis endpoint --set-default -e https://travis.fewlaps.com/api
With this, one can drop the -e https://travis.fewlaps.com/api for the above login command.
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
- 19,337
- 4
- 43
- 52
- 11,395
- 5
- 47
- 59
-
1Thanks. This made my Friday! – pushkarnk Feb 03 '17 at 09:30
-
Nice! I wrote it at StackOverflow to remember it to me of the future... and also to you! :·D – Roc Boronat Mar 21 '17 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 (https://github.com/travis-ci/travis.rb/issues/588) – arewm Mar 15 '18 at 12:26
-
@arewm sorry, but now I don't use Travis anymore, so I can't try it again. – Roc Boronat Mar 16 '18 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 '18 at 16:58
-
@arewm haha, well, thanks for sharing that the answer is up to date! :·D – Roc Boronat Mar 21 '18 at 21:35
-
Facing to the "SSL error: could not verify peer", though "-I" is specified in command which means "do not verify SSL certificate of API endpoint"... – Skay Apr 08 '18 at 20:57
-
1Note: if you use the `travis endpoint ...` first, then the login command shortens to `travis login --github-token ....` – colm.anseo Mar 01 '23 at 14:49
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
- 915
- 9
- 20
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.
- 649
- 3
- 12
-
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 '19 at 21:19