I am following the tutorial to deploy Laravel application with GitLab CI/CD on DigitalOcean server (https://docs.gitlab.com/ee/ci/examples/laravel_with_gitlab_and_envoy/) and it works great.
I am trying to do the deployment to FortRabbit and kinda stuck
This is my .gitlab-ci.yml
image: registry.gitlab.com/{{username}}/laravel57
services:
- mysql:5.7
variables:
MYSQL_DATABASE: homestead
MYSQL_ROOT_PASSWORD: secret
DB_HOST: mysql
DB_USERNAME: root
stages:
- test
- deploy
unit_test:
stage: test
script:
- cp .env.example .env
- composer install
- php artisan key:generate
- php artisan migrate
- vendor/bin/phpunit
deploy_production:
stage: deploy
script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY_FROM_HOMESTEAD")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- git clone git@gitlab.com:{{username}}/laravel57.git
- cd laravel57
- git remote add fortrabbit {{app-name}}@deploy.us1.frbit.com:{{app-name}}.git
- git push -u fortrabbit master
environment:
name: production
url: http://192.168.1.1
when: manual
only:
- master
What I got is
Cloning into 'laravel57'...
Warning: Permanently added 'gitlab.com,xx.xxx.xx.xxx' (ECDSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
ERROR: Job failed: exit code 1
Any suggestions?