How to add an SSH key in Travis CI?

Travis Doc has a “SSH Key” tab in the settings, but not in my account. I need to add an SSH key to clone submodules in Gihub.

My account:

enter image description here

Travis Doc:

enter image description here

+8
github git-submodules ssh-keys continuous-integration travis-ci
source share
2 answers

This feature is only available to private repositories at this time.

For public repositories, you don't need to be private Git URLs (assuming they are on GitHub), so changing URLs to use public clone URLs should do the trick.

+9
source share

Using SSH keys is only available for private repositories on traviscc.com (paid plans).

Using the travis command-line travis you can create a new SSH key that will be configured on both Travis CI and your GitHub account (if you use the special GitHub user for Travis CI).

Here are the necessary console commands:

 # Install Travis command line tool gem install travis # Login to Travis Pro (private repositories) account travis login --pro # Generate and setup SSH key for your GitHub repository travis sshkey --generate -r organization/repository 

Instead of generating a new SSH key with travis , you can also load an existing SSH key using

 travis sshkey --upload "C:\my_keys\id_rsa" -r organization/repository 

After the SSH key has been created, it is recommended that this key be noted in the config file in the .ssh your Travis user. You can do this by adding these lines to your .travis.yml :

 # http://docs.travis-ci.com/user/build-lifecycle/ before_script: - echo -e "Host github.com\n\tHostName github.com\n\tUser git\n\tIdentityFile ~/.ssh/id_rsa\n" >> ~/.ssh/config 

For more information, this is a link to the official documentation: Creating a new key .

+9
source share

All Articles