gitlab-ci.yml 同步https 仓库地址

复制代码
1. 先在要部署的机器上,执行如下命令, 输入一次密码后,保存该密码
bash 复制代码
git config --global credential.helper store
复制代码
2. 然后执行 git pull 命令, 然后会提示输入密码, 输入密码即可.

3. 编写 gitlab-ci.yml 文件
bash 复制代码
stages:
  - deploy

# 部署master服务
deployMaster:
  stage: deploy
  script:
    - echo "666"
    - cd /home/vhost/
    - git pull origin master
    - echo "success"
复制代码
然后就可以成功了, 如果不成功, 可能需要配置一下 gitlab-runner
bash 复制代码
gitlab-runner uninstall
# 再安装,同时指定工作目录和使用的用户
gitlab-runner install --working-directory /root --user root

sudo service gitlab-runner restart

你执行 git pull 时候是哪个用户 --user 就填写哪个用户.

相关推荐
daemon.qiang8 分钟前
Ubuntu 20.04+安装JFrog CLI超详细指南
linux·运维·ubuntu
小夏子_riotous9 分钟前
Docker学习路径——6、简单微服务
linux·运维·服务器·docker·微服务·容器·云计算
剪刀石头布Cheers10 分钟前
Ubuntu Hermes安装关键步骤
linux·运维·ubuntu·ai·agent·hermes
咚为18 分钟前
从Nginx到Pingora?从 Cloudflare 的架构演进讲起
运维·nginx·架构
willhuo20 分钟前
服务器大存储与实时备份解决方案:基于SSH隧道的灾备数据同步系统
运维·服务器·ssh
bukeyiwanshui22 分钟前
20260423 一、 负载均衡-LVS 全解析
运维·负载均衡·lvs
IT摆渡者24 分钟前
Linux 巡检脚本BASH
linux·运维·bash
小宋加油啊24 分钟前
服务器双卡5090 配置深度学习环境
运维·服务器·深度学习
minji...24 分钟前
Linux 网络套接字编程(二)从 0 到 1 实现 UDP 回声服务器,recvfrom,sendto
linux·运维·网络·单片机·udp
Cyber4K26 分钟前
【DevOps专项】GitLab 与 Jenkins 介绍及部署持续集成环境
运维·ci/cd·gitlab·jenkins·devops