Created
August 28, 2019 09:22
-
-
Save vtenq/e6e6c9e6d664721b5b028b5ae319d5e8 to your computer and use it in GitHub Desktop.
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
# Install ssh client if not installed yet | |
- 'which ssh-agent || (apt-get update -y && apt-get install openssh-client -y)' | |
- eval $(ssh-agent -s) | |
# Add ssh private to the agent where $SSH_PRIVATE_KEY is env variable | |
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null | |
- mkdir -p ~/.ssh && chmod 700 ~/.ssh | |
# Add remote server to known hosts (change IP Address, and also the remote server | |
# should already have public key installed so that it will be possible to connet) | |
- ssh-keyscan -H 127.0.0.1 >> ~/.ssh/known_hosts | |
# Set appropriate access for known_hosts file | |
- chmod 644 ~/.ssh/known_hosts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment