Here is the content of .gitlab-ci.yml
file:
stages:
- deploy
deploy_job:
stage: deploy
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" | tr -d 'r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H gitlab.com >> ~/.ssh/known_hosts
- ssh-keyscan -H 37.152.183.16 >> ~/.ssh/known_hosts
script:
- echo "Deploying to server...."
- git config --global url."[email protected]:".insteadOf "https://gitlab.com/"
- ssh -o StrictHostKeyChecking=no [email protected] "cd /var/www/api && git pull origin master"
only:
- master
It fails with no error, here is the log:
See? I cannot find any error there. Any idea what’s wrong and how can I fix it?