[英]Git pull CI/CD GitLab Deploy on server Cloudways
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”).在我的 gitlab-ci.yml CI 的部署实习中,我想自动将更改从我的 repo 发送到我的 Cloudways 服务器(不使用 cloudways 手册“通过 Git 部署”)。 my project is in the /root/public_html/
我的项目在 /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? CI 运行时出现错误路径“public_html/:没有这样的文件或目录”你有提示,一个好的做法吗?
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.这样,您就可以直接将 go 放在您知道存储库应该在的位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.