GITLAB-CI:使用GIT在站点上部署

GITLAB-CI:使用GIT在站点上部署,git,gitlab-ci,Git,Gitlab Ci,我来这里是想了解我的CICD出了什么问题 背景: 源代码托管在私有GITLAB projet中 web应用程序(laravel/php)由GANDI(simplehosting)托管 在simplehosting报价中,可以 我的目标是管理cicd管道(使用gitlab ci),以便检查代码质量、运行单元测试并在测试/阶段环境中自动部署。然后以手动方式部署到生产环境中 我的问题是部署阶段:如何将我的gitlab repo推(部署)到托管git中 我最初担心的是没有什么可推动的(从我的跑步者/

我来这里是想了解我的CICD出了什么问题

背景:

  • 源代码托管在私有GITLAB projet中
  • web应用程序(laravel/php)由GANDI(simplehosting)托管
  • 在simplehosting报价中,可以
我的目标是管理cicd管道(使用gitlab ci),以便检查代码质量、运行单元测试并在测试/阶段环境中自动部署。然后以手动方式部署到生产环境中

我的问题是部署阶段:如何将我的gitlab repo推(部署)到托管git中

我最初担心的是没有什么可推动的(从我的跑步者/图像中查看)。 我有和
src refspec
错误

$ git push gandi master
error: src refspec master does not match any.
error: failed to push some refs to 'git+ssh://xxx@git.sd6.gpaas.net/test.domain.tl.git'
ERROR: Job failed: exit code 1
我尝试了在我的
git-push中使用
HEAD:
选项提出的解决方案 而
作业成功了

但是主机服务器上没有更新

我理解没有更新来推动跑步者的观点

$ git status
HEAD detached at ff1ce8c
nothing to commit, working tree clean
那怎么办呢?
我正在寻找新的探索途径


我的gitlab-ci.yml

image: php:latest

before_script:
  - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
  - mkdir -p ~/.ssh
  - eval $(ssh-agent -s)
  - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
  - ssh-add <(echo "$SSH_PRIVATE_KEY")

stages:
  - deploy

job_deploy_staging:
  stage: deploy
  script:
    - echo "Deploy the app into (gandi) staging environnement"
    - git config --global user.email "$GIT_EMAIL" && git config --global user.name "$GIT_NAME"
    - git remote add gandi git+ssh://$GANDI_USER@$GANDI_GITSERVER/$GANDI_GITREPO_TEST
    - git status
    - git show
    - git push gandi HEAD:master
  environment:
    name: staging
    url : http://test.domain.tl
  only:
    - master


job_deploy_prod:
  stage: deploy
  script:
    - echo "Deploy the app into (gandi) production environnement"
    - git config --global user.email "$GIT_EMAIL" && git config --global user.name "$GIT_NAME"
    - git remote add gandi git+ssh://$GANDI_USER@$GANDI_GITSERVER/$GANDI_GITREPO_PROD
    - git push gandi master
  environment:
    name: production
    url : http://www.domain.tl
  when: manual
  only:
    - master
image:php:latest
在脚本之前:
-'哪个ssh代理| |(apt get update-y&&apt get install openssh client git-y)'
-mkdir-p~/.ssh
-eval$(ssh代理-s)
-“[[-f/.dockerenv]]和&echo-e”主机*\n\t三通键检查号\n\n“>~/.ssh/config”

-ssh添加您必须签出完整的git repo。执行
GIT\u策略:克隆
,否则该树仅用于获取
'[-f…'
-无需引用,您可以删除
'
。您必须签出完整的git repo。执行
git\u策略:克隆
,否则树仅为获取。
'[-f…'
-无需引用,您可以删除
'