Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Run Travis build locally


  1. POSIX or Windows system
  2. Install Docker
  3. A GitHub repo that already builds on Travis


  • Identical output as if run from Travis

Project status:

  • Alpha quality, please post notes here and fork baby fork, I will try to test and accept changes here


  1. Install Travis on Docker

    # choose the image according to the language chosen in .travis.yml
    $ docker run -it -u travis /bin/bash
    # now that you are in the docker image, switch to the travis user
    sudo — travis
    # Install a recent ruby (default is 1.9.3)
    rvm install 2.3.0
    rvm use 2.3.0
    # Install travis-build to generate a .sh out of .travis.yml
    cd builds \
    git clone \
    cd travis-build \
    gem install travis \
    travis # to create ~/.travis \
    ln -s `pwd` ~/.travis/travis-build \
    bundle install
    # Create ssh key for Github
    ssh-keygen -t rsa -b 4096 -C “YOUR EMAIL REGISTERED IN GITHUB”
    # Click enter to use default location for key
    # You can choose empty passphrase by clicking enter twice
    # Now that we have the key, let’s share with Github
    less ~/.ssh/
    # Copy the contents of the
  2. Go to your Github SSH key settings

  3. Create a new ssh key with title: “docker key”: “PASTE THE KEY CONTENTS HERE”

  4. Go back to docker terminal

    # Create project dir, assuming your project is `AUTHOR/PROJECT` on GitHub
    cd ~/builds \
    mkdir AUTHOR \
    cd AUTHOR \
    git clone \
    cd PROJECT
    # change to the branch or commit you want to investigate
    # compile travis script into bash script
    travis compile >
    # Go to bash script and fix the branch name
    # in Vi type “/branch” to search and add the right branch name
    # — branch\=\’\NEW_BRANCH’\
    # You most likely will need to edit as it ignores ‘matrix’ and ‘env’ keywords

This comment has been minimized.


This comment has been minimized.

Copy link
Owner Author

@fulldecent fulldecent commented Feb 28, 2018



This comment has been minimized.

Copy link

@mikehardy mikehardy commented Jun 1, 2018

Before anyone else wastes their time, I'm only receiving this as output, even if travis-build lint says it's clean and I've followed all the information in all the comments on all the github issues in the world to get it working >:-(

travis@01997857cd39:~/builds/startup-threads-cli$ /home/travis/.travis/travis-build/bin/travis compile --no-interactive
detected repository as soulshake/startup-threads-cli
echo -e ""
echo -e "There was an error in the .travis.yml file from which we could not recover.
echo -e "Unfortunately, we do not know much about this error."
echo -e ""
echo -e "Please review"
exit 2

This comment has been minimized.

Copy link

@ekivolowitz ekivolowitz commented Jun 20, 2018

@mikehardy I found a fix for this. See issue here. Be sure to use the issue_9709_fix branch.


This comment has been minimized.

Copy link

@shijiezhou1 shijiezhou1 commented Apr 4, 2019

9bd3d9c978b:~/builds/travis-build$ gem install travis
ERROR: Could not find a valid gem 'travis' (>= 0), here is why:
Unable to download data from - SSL_conn
ect returned=1 errno=0 state=unknown state: tlsv1 alert protocol versio
n (

I can't install please !


This comment has been minimized.

Copy link

@thamaraiselvam thamaraiselvam commented Oct 20, 2019

@shijiezhou1 try to add HTTP

$ gem sources --remove
$ gem sources -a

This comment has been minimized.

Copy link

@c5253458 c5253458 commented Jan 23, 2020

This works on one platform only: x86_64, as it depends on


This comment has been minimized.

Copy link

@laszewsk laszewsk commented Mar 5, 2020

I get now

bundle install
bash: bundle: command not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment