Travis Authentication with Heroku

A note about Heroku and Travis CI

Setting up Authentication

  1. Install Ruby for your operating system. You can follow the instructions here for your operating system. For Windows it may look like this:
Installation

2. Then use gem (package installer for Ruby) to install the Travis CI command line: $ sudo gem install travis (You may not need the ‘sudo’ depending on your operating system)

Install Travis

3. Travis will need to log in to your GitHub account to continue. If you aren’t able to get it working through the command-line options to enter a password, you may need to create an access token through the GitHub API and make it available to my system. To create an access token, go here

4. Give the token a note and ensure the above three boxes are clicked on the GitHub personal access token page.

Select Repo, user:email and read:org

5. After you press Generate token a long string will be generated which you can use in the next step.

Your GitHub Token

6. Once you have the token, open up your _netrc file (it may be called .netrc depending on your system) in your home directory. You can usually find this on your C: drive under your username.

7. There may already be other entries in this file and if so, add the following at the bottom:

machine github.com

  • login <your GitHub login username, not email>
  • password <the key generated by GitHub>

machine api.github.com

  • login <your GitHub login username, not email>
  • password <the key generated by GitHub>
This file may or may not empty

8. Save this file.

9. Using the terminal, cd into your repo folder and run the following command to have the Travis CI command line tool update your travis.yml (*below the “—” denotes a double dash*):

  • travis login — pro

10. If this doesn’t log you in automatically, then use the following command:

  • travis login — pro — github-token [paste your token here]

10a. Then, when you see that you’ve been successfully logged in, type the following command:

  • travis encrypt $(heroku auth:token) — add deploy.api_key — pro

11. You can check your travis.yml to see if it changed as a result of this command. Once done, pushing to git should not have Travis kick off correctly and deploy to Heroku successfully.

Congratulations! Your site should be deployed and pipelined!

--

--

My name is Spandana Nallapati and I am a fullstack software engineer, who, previously, worked as a developmental behavioral pediatrician.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Spandana Nallapati

My name is Spandana Nallapati and I am a fullstack software engineer, who, previously, worked as a developmental behavioral pediatrician.