Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
830 views
in Technique[技术] by (71.8m points)

github - How to add SSH Key in Travis CI?

In Travis Doc there is tab "SSH Key" in Settings, but not in my account. I need to add SSH Key to clone submodules on GitHub.

My Account:

enter image description here

Travis Doc:

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

With the travis command line tool you can generate a new SSH key which will be set up on both Travis CI and your GitHub user account (if you use a dedicated 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, it's also possible to upload an existing SSH key with:

travis sshkey --upload "C:my_keysid_rsa" -r organization/repository

Once the SSH key has been created, it is recommended that this key will be refrenced from the config file in the .ssh directory of 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
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
" >> ~/.ssh/config

For more information, here is a link to the official documentation: Generating a new key.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...