On the install step, Travis CI clones the repo, which looks similar to this:
git clone --depth=50 --branch=master https://github.com/user/repo.git user/repo
How can I customize / override this?
Background: I am using tag based deploys. The way Travis checks out tagged builds (--branch=<tagname>
), the git repository is in a detached state without access to branches. However, for deployment I need to know on which branch I am. My solution is to do a "normal" clone and then switch to the tagged commit.
Configuration. Travis CI is configured by adding a file named . travis. yml , which is a YAML format text file, to the root directory of the repository.
Custom SSH keys are currently only available for private repositories on travis-ci.com. You can add SSH keys to user accounts on GitHub. Most users have probably already done this to be able to clone the repositories locally. This way, a single key can access multiple repositories.
Travis CI supports parallel testing. It can also be integrated with tools like Slack, HipChat, Email, etc. and get notifications if the build is unsuccessful. Developers can speed up their test suites by executing multiple builds in parallel, across different virtual machines.
You can clone the repository again in the install step. That way you clone the repository twice, but it seems to work.
# .travis.yml install: - git clone https://github.com/$TRAVIS_REPO_SLUG.git $TRAVIS_REPO_SLUG - cd $TRAVIS_REPO_SLUG - git checkout -qf $TRAVIS_COMMIT
Per the Travis docs you can add the following to your .travis.yml
to remove the --depth
flag:
git: depth: false
As --depth
implies --single-branch
, removing this flag means that all branches will be checked out, which isn't the default behaviour.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With