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 就填写哪个用户.

相关推荐
岳来几秒前
docker 从 Path 值看容器启动命令
运维·docker·容器
RisunJan1 小时前
Linux命令-ifconfig命令(配置和显示网络接口的信息)
linux·运维·服务器
杭州泽沃电子科技有限公司1 小时前
面对风霜雨雪雷电:看在线监测如何为架空线路筑牢安全网
运维·人工智能·在线监测·智能监测
lbb 小魔仙1 小时前
【Linux】100 天 Linux 入门:从命令行到 Shell 脚本,告别“光标恐惧”
linux·运维·服务器
早川9192 小时前
Linux系统
linux·运维·服务器
iFlow_AI3 小时前
iFlow CLI + ACK MCP Server:让 ACK 容器运维进入对话时代
运维·ack·iflow·iflow cli
IT利刃出鞘3 小时前
Docker Compose--解决容器时间不正确的问题
运维·docker·容器
山上三树3 小时前
进程状态详解
linux·运维·服务器
山上三树3 小时前
task_struct 详解
运维·服务器·网络
oMcLin3 小时前
如何打造Linux运维监控平台:Prometheus + Grafana实战与性能优化
linux·运维·prometheus