Skip to content

Instantly share code, notes, and snippets.

@HighwayofLife
Forked from qoomon/TravisGitHub.md
Created March 22, 2018 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HighwayofLife/ff62af6ba74a219d1d5bbe9cad3e29ae to your computer and use it in GitHub Desktop.
Save HighwayofLife/ff62af6ba74a219d1d5bbe9cad3e29ae to your computer and use it in GitHub Desktop.
Setup GitHub Deploy Keys For Travis

Setup Travis Deploy

gem install travis

ssh-keygen -t rsa -b 4096 -f 'github_deploy_key' -N ''

cat github_deploy_key.pub | pbcopy

set public key as deploy key on github e.g https://github.com/USER/REPO/settings/keys

rm 'github_deploy_key.pub'

travis login --org --auto

travis encrypt-file 'github_deploy_key'

rm 'github_deploy_key'

git add 'github_deploy_key.enc'

add openssl line to before_install stage in your .travis.yml e.g.

before_install:
  - >-
    openssl aes-256-cbc 
    -K $encrypted_xxxxxxxxxxxx_key 
    -iv $encrypted_xxxxxxxxxxxx_iv 
    -in github_deploy_key.enc 
    -out github_deploy_key 
    -d
  - chmod 600 github_deploy_key
  - eval $(ssh-agent -s)
  - ssh-add github_deploy_key

git add '.travis.yml'

git commit -m 'chore: add github deploy key'

git push

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