.gitlab.ci.yml ��zw8V �)xw8V # Image neeeds to have ssh-client image: docker:git services: - docker:dind stages: - staging before_script: - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY - mkdir -p ~/.ssh # Paste the PRIVATE key into a gitlab variable. Pay attention to the linebreak at the end when pasting - echo "$DEPLOY_SERVER_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa - chmod 60
![.gitlab.ci.yml for SSH with private key.](https://cdn-ak-scissors.b.st-hatena.com/image/square/1ef26f6cb4349557952890dbe3e567f7f98dc151/height=288;version=1;width=512/https%3A%2F%2Fgithub.githubassets.com%2Fassets%2Fgist-og-image-54fd7dc0713e.png)