Created
April 21, 2021 07:44
-
-
Save halimarm/d9bd50cf8f944899f9d7c7247066ed37 to your computer and use it in GitHub Desktop.
Deploy with ssh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before_script: | |
- apt-get update -qq | |
- apt-get install -qq git | |
# Setup SSH deploy keys | |
- 'which ssh-agent || ( apt-get install -qq openssh-client )' | |
- eval $(ssh-agent -s) | |
- ssh-add <(echo "$SSH_PRIVATE_KEY") | |
- mkdir -p ~/.ssh | |
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' | |
deploy_staging: | |
type: deploy | |
environment: | |
name: staging | |
url: example.com | |
script: | |
- ssh root@example.com "cd var/www/ && git pull origin master && exit" | |
only: | |
- master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment