我正在尝试在我的服务器上安装GitLab .

我想做什么 -

  • Push the branch from local system to GitLab server.

  • merge the branch on GitLab server and deploy to staging server using SSH.

  • If Everything fine deploy to production server using SSH.

  • Revert the changes on staging or production server.

到目前为止我做了什么 -

  • 在服务器上设置GitLab .

  • 可以从本地服务器推送分支,并可以在GitLab上合并 .

Problem:

我在部署分支时面临的问题是 -

无法在登台服务器上部署分支 .

enter image description here

stages:
      - staging

    deploy_staging:
      stage: staging
      before_script:
        - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
        - chmod 644 ~/.ssh/known_hosts
      script:
        - ssh user@ip "cd /home/public_html/gitlab-test &&
            git checkout master &&
            git pull origin master "
      environment: staging
      only:
        - master

我跟着

https://docs.gitlab.com/ee/ci/ssh_keys/README.html

https://www.sebastianklier.com/gitlab/2017/10/01/automatic-deployments-to-remote-with-gitlab-ci.html

https://florianbrinkmann.com/en/3473/deployment-gitlab-ci/

https://hackernoon.com/setting-up-ci-cd-on-gitlab-step-by-step-guide-part-1-826385728223

但看起来我错过了一些东西 . 任何视频教程或详细解释将非常感激 .

我没有在这里使用Docker .