cfsky 发表于 2018-1-12 16:35:23

git hook 自动部署

  1. 当前虚拟站点根目录的 .git/ 权限
  2. 当前项目裸仓库创建 hooks/post-receive 文件,并给予x 的权限
  3. 复制如下内容
  

#!/bin/sh  
unset $(git rev-parse --local-env-vars)
  
REPO="git@123.111.11.11:edc2.git"
  
#BRANCH=`echo $refname | sed -n 's/^refs\/heads\///p'`
  
#BRANCH_DIR="/root"
  
SSH_DEST="root@iZ255rhjhjhjhjhjhjt7otpZ"
  
ssh "$SSH_DEST" /bin/sh <<-EOF
  
cd /alidata/www/v2.edc.com
  
git pull origin master
  
EOF
  

  

  *******************
  可能有如下问题
  su - git
  ssh-keygen
  ssh-copy-id michael@docker.example.com
  ssh michael@docker.example.com
  http://stackoverflow.com/questions/37455781/gitlab-post-receive-hook-host-key-verification-failed
页: [1]
查看完整版本: git hook 自动部署