In my Deploy internship of my gitlab-ci.yml CI, I want to automatically send the changes from my repo to my Cloudways server (without using the cloudways manual “deploy via Git”). my project is in the /root/public_html/
So I do this:
deploy:
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")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n
$APP_USER@$APP_HOST" > ~/.ssh/config'
- cd public_html/ && git pull origin main && composer install
environment:
name: production
only:
- main
The CI is running with error path " public_html/: No such file or directory " Do you have a tip, a good practice?
thanks in advance
You can start and use the actual full path instead of relying on the current working directory:
- cd /root/public_html/ && ...
That way, you go directly where you know your repository is supposed to be.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.